【发布时间】:2021-03-25 18:12:54
【问题描述】:
我正在尝试从此链接获取表格:https://www.nba.com/standings?GroupBy=conf&Season=2019-20&Section=overall
url = 'https://www.nba.com/standings?GroupBy=conf&Season=2019-20&Section=overall'
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html.parser')
soup.find_all('table')
但是,我返回了一个空列表。我查看了网站的 html,我可以看到表格标签。拉这些表我缺少什么?
【问题讨论】:
-
看起来表格是通过 JavaScript 加载的,所以不幸的是,从 URL 中获取不会包含它。您可以通过打印出
requests加载的内容来检查。