第六章python网络爬虫(不带验证和代理)
python
网络爬虫
爬虫:爬虫步骤:1、通过网络地址获取网络页面。2、对网络页面内容的解析。3、爬取数据放到本地。4、使用爬取的本地数据。。
示例:获取网页内容。
import requests as rq
url='https://www.guazi.com/sh/buy/'
def gethtmlcontent(url):
try:
#请求方式和设置超时
r=rq.get(url=url,timeout=30)
r.raise_for_status()
原创
2020-09-23 10:35:36 ·
340 阅读 ·
0 评论