python爬虫
import requestsimport bs4resp=requests.get('https://www.baidu.com') #请求百度首页print(resp) #打印请求结果的状态码print(resp.content) #打印请求到的网页源码bsobj= bs4.BeautifulSoup(resp.content, 'lxml')a_list=bsobj.find_all('a')text=''for a in a_list: href=(a.get('hre.
原创
2022-01-25 16:56:02 ·
87 阅读 ·
0 评论