【发布时间】:2017-06-01 18:23:53
【问题描述】:
我正在尝试使用beautifulsoup来解析下面url中表格中的数据,
http://hk.warrants.com/home/en/sgdata/list_e.cgi#topsearch
由于表没有类属性或id,我不能使用soup.find("table", {"title":"TheTitle"}) 的正常方法来定位表。相反,我试过了,
warrantUrl = 'http://hk.warrants.com/home/en/sgdata/list_e.cgi#topsearch'
warrantPage = urlopen(warrantUrl)
soup = BeautifulSoup(warrantPage, 'html.parser')
table = soup.find_all("tr")
paragraphs = []
for x in table:
paragraphs.append(str(x))
另外,我尝试了这篇文章中提到的方法, Parse table with BeautifulSoup Python 。但是没有成功...
【问题讨论】:
标签: python beautifulsoup