我使用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