def download_page(url):
#请求头
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0"}
r = requests.get(url,headers = headers)
r.encoding = 'utf-8' #在这里将返回结果的格式设置为utf-8
return r.text
```
Python爬虫学习之路的问题2 -- 爬虫结果显示乱码
最新推荐文章于 2024-07-12 16:16:27 发布