【发布时间】:2021-08-05 07:42:50
【问题描述】:
我想从这个页面https://www.betexplorer.com/soccer/england/premier-league-2019-2020/results/刮一张表我可以得到所有的数据,但我不能得到赔率的列
url = 'https://www.betexplorer.com/soccer/england/premier-league-2019-2020/results/'
r = requests.get(url)
soup = BeautifulSoup(r.text, 'lxml')
table = soup.find('table', class_="table-main js-tablebanner-t js-tablebanner-ntb")
for row in table.find_all('tr')[1:]:
data = row.find_all('td')
row_data = [td.text.strip() for td in data]
print(row_data)
输出
['Arsenal - Watford', '3:2', '', '', '', '26.07.2020']
['Burnley - Brighton', '1:2', '', '', '', '26.07.2020']
['Chelsea - Wolves', '2:0', '', '', '', '26.07.2020']
['Crystal Palace - Tottenham', '1:1', '', '', '', '26.07.2020']
['Everton - Bournemouth', '1:3', '', '', '', '26.07.2020']
['Leicester - Manchester Utd', '0:2', '', '', '', '26.07.2020']
['Manchester City - Norwich', '5:0', '', '', '', '26.07.2020']
['Newcastle - Liverpool', '1:3', '', '', '', '26.07.2020']
['Southampton - Sheffield Utd', '3:1', '', '', '', '26.07.2020']
['West Ham - Aston Villa', '1:1', '', '', '', '26.07.2020']
[]
【问题讨论】:
标签: python beautifulsoup html-table