Requests库学习

 

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属性重新赋值,用推测的编码去解析网页内容

 

posted on 2022-01-08 06:48  进击的许盈盈  阅读(58)  评论(0)    收藏  举报