【发布时间】:2013-03-24 07:34:28
【问题描述】:
我想做的是找到关键“符号”下的市场价值。
使用此代码我得到错误
File "C:\Python27\bitcoinAPI", line 9, in getmarket
for key, value in data.items():
AttributeError: 'list' object has no attribute 'items'
代码如下:
def getmarket():
page = urllib2.urlopen("http://bitcoincharts.com/t/markets.json")
data = json.load(page)
for key, value in data.items():
if ["symbol"] == "mtgoxUSD":
print ["symbol"]
getmarket()
我也试过了
for key, value in data.itervalues():
for key, value in data.iteritems():
他们都说列表没有任何属性
【问题讨论】:
标签: json python-2.7 dictionary