试图解析 table 的真正困难

real struggle trying to parse a table

我正在尝试从网络上解析 table(价格),结果是一场真正的斗争

这是网络

url='http://www.zonebourse.com/AEX-7959/composition/'

bs4:

r = requests.get(url)
data = r.text
soup = BeautifulSoup(data,"html5lib")
tables =soup.find('table',id='ALNI4')

print tables

使用 html5lib:

df=pd.read_html(url)
print df

在这两种情况下都没有找到 table,谁能帮我解析 table 或至少了解问题所在?

ValueError: No tables found

如果可能的话,我想放弃xml的选项,因为安装有问题所以根本不要使用。

提前致谢

您似乎在寻找

url='http://www.zonebourse.com/AEX-7959/composition%E2%80%8C%E2%80%8B/'

出于某种原因,您指向的 URL 是错误的。我搜索了一下URL到底是什么,居然是http://www.zonebourse.com/AEX-7959/composition%E2%80%8C%E2%80%8B/.

我不知道为什么 URL 这么奇怪。

如果您进行了该编辑,(url='http://www.zonebourse.com/AEX-7959/composition%E2%80%8C%E2%80%8B/')您的代码应该可以正常工作(虽然我自己没有测试过!)

希望对您有所帮助!好机会!