2016-09-23 7 views
2

下記のリンクからすべての年のEPS値(年間トレンド下)をダウンロードします。 http://www.bseindia.com/stock-share-price/stockreach_financials.aspx?scripcode=500180&expandable=0URLからテーブルから1行を抽出

私は美しいスープを使用して、以下の答えを試しました。 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') 

私はこれを成し遂げるために、他の言語を使用することに開いていたテキストがTDないTRである

+0

別のアプローチは、find_next_siblingsを呼び出すことだろうか? –

+0

オブジェクトtrが空です。 – user1638998

答えて

関連する問題