我正在使用Matplotlib金融与Python获得股票报价,从雅虎!金融。
我想知道是否有办法获得本季度每股收益,以及过去5年(即过去20个季度)使用Matplotlib金融公司获得的每股收益。
如果没有,有人能告诉我有这些数据的python库吗?
发布于 2016-06-01 14:51:22
这对我有用。
from urllib import urlopen
from bs4 import BeautifulSoup
url = 'http://www.marketwatch.com/investing/stock/goog/financials'
text_soup = BeautifulSoup(urlopen(url).read()) #read in
titles = text_soup.findAll('td', {'class': 'rowTitle'})
for title in titles:
if 'EPS (Basic)' in title.text:
print [td.text for td in title.findNextSiblings(attrs={'class': 'valueCell'}) if td.text]结果: u'15.10',u'16.42',u'18.29',u'20.27',u'23.88‘
https://stackoverflow.com/questions/37286465
复制相似问题