requests 库获取 response 数据

创建日期: 2023-08-17 16:06 | 作者: 风波 | 浏览次数: 14 | 分类: Python

来源:https://stackoverflow.com/questions/18810777/how-do-i-read-a-response-from-python-requests

python 2

>>> import requests
>>> response = requests.get("http://www.google.com")
>>> print response.content
'<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage"><head>....'
>>> print response.content == response.text
True

python 3

>>> print response.content == response.text
False

>>> print str(response.content) == response.text
True
14 浏览
6 爬虫
0 评论