Requests is an elegant and simple HTTPlibrary for Python, built for human beings.
此处是讽刺python自带的库Requests
Requests: HTTP for Humans™ — Requests 2.27.1 documentation (python-requests.org)
使用Requests发起get请求库
url ='https://www.qq.com' r = requests.get(url) r.test #查看网页源代码
r.encoding #查看网页使用的编码
r.apparent_encoding #使用appent_encoding用软件推测网页编码
r.encoding=r.apparent_encoding #给encoding属性重新赋值,用推测的编码去解析网页内容