我正在尝试使用BeautifulSoup4和Requests刮取XML页面的数据,但是我似乎无法打印结果。我没有收到错误,但是没有数据打印。
import time
import requests
from bs4 import BeautifulSoup
url = "website.com?xml=1"
result = requests.get(url)
content = result.content
soup = BeautifulSoup(content, "html.parser")
steamID = soup.find_all("x")
print (y)
您应该使用xml解析器:
soup = BeautifulSoup(content, "xml")
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句