
爬虫
文章平均质量分 76
爬虫
一条活在淡水湖里的鱼
这个作者很懒,什么都没留下…
展开
-
Python网络爬虫与信息提取
requests库安装:pip install requests安装完成之后,打开ide测试import requests# 访问百度r = requests.get("http://wwww.baidu.com")# 返回状态码r.status_code# 改变网页编码为utf-8r.encoding = 'utf-8'# 以文本格式显示网页信息r.textreque...原创 2020-03-10 23:10:56 · 388 阅读 · 0 评论 -
Python爬取淘宝商品信息
在爬取淘宝商品信息时,需要先登录获取Cookie并且模拟User-Agentheaders = { "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari...原创 2020-03-09 21:29:44 · 931 阅读 · 5 评论 -
Python爬虫定向抓取静态网页
# 静态定向爬虫# 爬取中国大学排名import requestsfrom bs4 import BeautifulSoupimport bs4# 定义从网页获取信息的函数def getHTMLText(url): try: r = requests.get(url) r.raise_for_status() r.encoding = r.apparent...原创 2020-03-08 21:47:27 · 231 阅读 · 0 评论