我使用yahoo_finance
模块从Y!F
提取数据。 A型错误:Python,不支持索引的对象
'Share' object does not support indexing
正在发生。
任何想法?
import yahoo_finance
from yahoo_finance import Share
class ticker(object):
def __init__(self, symbol):
self.price = symbol.get_price()
self.change = symbol.get_change()
self.volume = symbol.get_volume()
symbol = ['GOOG','AAPL','MSFT']
lenSymbol = len(symbol)
cc = 0
while cc < lenSymbol:
stringSymb = symbol[cc]
symbol = Share(stringSymb) #TypeError occurring here
c = ticker(symbol)
output = ([c.volume, c.price, c.change, c.volume])
print (output)
cc += 1
请提供*全回溯*,而不仅仅是最后一行。 –
我敢打赌,这个问题是通过'Share'实例'symbol = Share(...)'来勾画出符号= ['GOOG',...]'的列表...... – jonrsharpe