我正在运行这个 python 3 脚本:
data = json.load(urllib2.urlopen('http://data.mtgox.com/api/1/BTCUSD/ticker')[2])
运行时出现此错误:
Attribute error: addinfourl instance has no attribute'__getitem__'
19 while True:
20 lcd.clear()
21 url = 'http://data.mtgox.com/api/1/BTCUSD/ticker'
22 data = json.load(urllib2.urlopen(url))['return']
23 lcd.message(datetime.now().strftime('%b %d %H:%M:%S\n'))
24 lcd.message( "MtGox: " + data["return"]["last"]["display"])
25 sleep(10)