遇到的一些问题解决方法

1.使用requests,模拟访问网站时,遇到安全证书的时候verify = False
2.遇到r.text查看相应内容为乱码的时候,使用r.content.decode('utf-8')(其中“utf-8”与response headers中的Content-Type中的charset一致)

# -*- coding:utf-8 -*-
import requests
re = requests.get(url='https://www.12306.cn/index/',verify = False)
print(re.content.decode('utf-8'))

猜你喜欢

转载自blog.csdn.net/u013155359/article/details/84793827