Python爬虫问题出在哪里了(代码)
Python爬虫代码如下:#导入库
import requests
#1、定义url和请求头
url='http://www.yuque.com/makeblock-help-center-zh/mcode/ee07g4'
headers={
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0'
}
#2、发起请求F
res=requests.get(url,headers=headers)
#3、检测请求是否成功
if res.status_code == 200 :
res_html = res.text #获取返回的数据
print(res_html)
页:
[1]