【发布时间】:2016-01-14 01:28:36
【问题描述】:
我是 beautifulsoup 的新手,我在篮球参考中使用它时遇到了麻烦。我正在尝试将 Advanced stats 的整个数据框存储到 pandas 数据框中,但我什至无法选择它。到目前为止,这是我的代码:
from urllib.request import urlopen
from bs4 import BeautifulSoup
import pandas as pd
url='http://www.basketball-reference.com/teams/ATL/2016.html'
html = urlopen(url)
soup = BeautifulSoup(html)
soup.findAll('table',attrs={'id': 'advanced'})
从上面的代码中选择高级后,我看到了我需要的 html,但我实际上无法解析和提取数据。
【问题讨论】:
标签: python python-3.x web-scraping beautifulsoup