【发布时间】:2017-02-01 16:12:27
【问题描述】:
我想从以下链接下载所有年份的 EPS 值(在年度趋势下)。 http://www.bseindia.com/stock-share-price/stockreach_financials.aspx?scripcode=500180&expandable=0
我尝试使用以下答案中提到的 Beautiful Soup。 Extracting table contents from html with python and BeautifulSoup 但是在下面的代码之后无法继续。我觉得我非常接近我的答案。任何帮助将不胜感激。
from bs4 import BeautifulSoup
import urllib2
html = urllib2.urlopen("http://www.bseindia.com/stock-share-price/stockreach_financials.aspx?scripcode=500180&expandable=0").read()
soup=BeautifulSoup(html)
table = soup.find('table',{'id' :'acr'})
#the below code wasn't working as I expected it to be
tr = table.find('tr', text='EPS')
我愿意使用任何其他语言来完成这项工作
【问题讨论】:
-
你得到了什么出乎意料的结果?
-
对象 tr 为空
标签: python html web-scraping beautifulsoup