我正在做一个需要网页抓取的项目。因此,我查看了Python中的请求库。在库的快速启动页面中,以下代码示例是given:
>>> import requests
>>> r = requests.get('https://github.com/timeline.json')
>>> r.text
'[{"repository":{"open_issues":0,"url":"https://github.com/...
在尝试该代码时,我发现在尝试打印r.text时返回以下错误:
^{pr2}$
我做错什么了?在
Tags:
请尝试
r.content
它应该可以与旧版本的请求或升级一起使用。要升级对python 2.7
的请求,请使用sudo pip-2.7 install requests upgrade
相关问题 更多 >
编程相关推荐