使用BeautifulGroup和请求从xml文件打印数据

2024-04-26 19:08:11 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用BeautifulSoup4和请求来获取数据的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)

Tags: 数据fromimporturltime错误页面xml