python - Python,将请求的结果解析为 xml
问题描述
我正在尝试使用 BeautifulSoup 将请求的结果解析为 xml。
但是,它返回错误消息:“TypeError:'Response' 类型的对象没有 len()”
这是我的代码:
r = requests.get(url, proxies=proxies, timeout=10)
result = BeautifulSoup(r,'html.parser')
解决方案
将响应的内容传递给 BeautifulSoup。
前任:
result = BeautifulSoup(r.text,'html.parser')