- parsel
相关模块可pip安装,如果觉得安装速度太慢点击下面链接查看相关教程
import requests
url = ‘http://sc.chinaz.com/yinxiao/’
headers = {
‘User-Agent’: ‘Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36’
}
response = requests.get(url=url, headers=headers)
print(response.text)
但是返回数据有中文乱码,编码出现了问题,所以咱们只需要转码一下就可以了
response.encoding = response.apparent_encoding