【发布时间】:2023-03-22 09:11:01
【问题描述】:
我正在尝试从该站点提取数据:
https://www.ultimatetennisstatistics.com/tournamentEvent?tournamentEventId=4073
我想要单场比赛的统计数据,例如决赛,你可以看到它点击蓝色图标。
This is what I see when I do so:
所以,我写了这段代码:
import requests
from bs4 import BeautifulSoup
headers = {'User-Agent': 'Mozilla5/.0'}
URL = "https://www.ultimatetennisstatistics.com/tournamentEvent?tournamentEventId=4073"
page = requests.get(URL, headers= headers)
soup = BeautifulSoup(page.content, 'html.parser')
stats = soup.find(id="matchStats-171140Overview")
print(stats)
但结果是“无”。我不明白为什么,因为那个 id 确实存在。我想得到,例如3.1%。
谁能帮帮我?
谢谢。
【问题讨论】:
-
代码中的错字,试试这个
stats = soup.find(id="matchStats-171140")
标签: python beautifulsoup