一、requests






如果r.text是乱码,则可以参考:


介绍HTTP协议:







代理服务器:防止爬虫过多拒绝被爬,即隐藏真实ip



get方法最常用






对于爬虫来说,这两个最常用



我写的例子

import requests
r=requests.get(“http://python123.io/ws/demo.html”)
r.text
‘
The demo python introduces several python courses.
\r\nPython is a wonderful general-purpose programming language. You can learn Python from novice to professional by tracking the following courses:\r\nBasic Python and Advanced Python.
\r\n’demo=r.text
博客围绕Python爬虫展开,重点介绍了requests库。提及若r.text乱码的参考方向,介绍了HTTP协议和代理服务器作用,强调get方法常用,并给出使用requests库发送get请求的示例代码。
&spm=1001.2101.3001.5002&articleId=109753300&d=1&t=3&u=3c2ee2aa8c04474c8280c71871358052)

被折叠的 条评论
为什么被折叠?



