import requests
from bs4 import BeautifulSoup
print('导包成功')
导包成功
url='http://www.xiaohuar.com/'
header={
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"}
def spider_xiaohua_content():
response=requests.get(url=url,headers=header)
print(response.status_code)
if response.status_code:
response.encoding='utf-8'
html=response.content
bts=BeautifulSoup(html,'html5lib')
div_list=bts.find_all('div',attrs={
'class':'all_lanmu'})
text=''
file=open('spider-校花.txt','w',encoding='utf-8')