如何使用BeautifulSoup获取表中的所有标签和您的内容

时间:2018-09-28 16:39:58

标签: python beautifulsoup css-selectors

我尝试使用以下命令获取“ tr”:

import os, bs4, requests
url ="https://projects.fivethirtyeight.com/2018-nfl-forecasting-game/leaderboard/"
page = requests.get(url)
soup = bs4.BeautifulSoup(page.content, 'html.parser')
table = soup.find('div', class_ = 'leaderboard-table-wrap')
trs = table.find_all('tr')

但是trs变量返回空结果集。


enter image description here


enter image description here

0 个答案:

没有答案