Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (19.9k points)

Not sure why this isn't working :( I'm able to pull other tables from this page, just not this one.

import requests
from bs4 import BeautifulSoup as soup
                   headers={'User-Agent': 'Mozilla/5.0'})
page = soup(url.content, 'html')
table = page.find('table', id='team_and_opponent')
print(table)

1 Answer

0 votes
by (25.1k points)

There is no table with id team_and_opponent in that page. Rather there is a span tag with this id. You can get results by changing id.

Related questions

0 votes
1 answer
asked Nov 1, 2020 in Data Science by blackindya (18.4k points)
0 votes
1 answer
asked Nov 1, 2020 in Data Science by blackindya (18.4k points)
0 votes
1 answer

Browse Categories

...