我对美汤的数据抓取还不熟悉。我想从职业橄榄球参考中获得这些统计数据:https://www.pro-football-reference.com/boxscores/201009090nor.htm#all_pbp
我想遍历完整的Play-By-Play表下的'Detail Column‘下的每一行,以便如果细节包含“Play”一词,我可以保存它。有没有人知道我是怎么做到的?这张表格看起来和其他表格不一样。
# Any example of how I extracted another element (Referee Name)
# from the same page but different table
table = soup.select_one('#all_officials').find_next(text=lambda t: isinstance(t, Comment))
table = BeautifulSoup(table, 'html.parser')
for tr in table.select('tr'):
tds = [td.get_text(strip=True) for td in tr.select('td')]
if str(*tds) != "Officials":
referee = str(*tds)
break
转载请注明出处:http://www.jxbyjx.net/article/20230517/2039485.html