我有一个来自api的json响应,我需要从以下位置获取“askPrice”值:
dict_items(
[
('SPY',
{
'assetType': 'ETF',
'assetMainType': 'EQUITY',
'cusip': '78462F103',
'assetSubType': 'ETF',
'symbol': 'SPY',
'description': 'SPDR S&P 500',
'bidPrice': 435.31,
'bidSize': 2100,
'bidId': 'T',
'askPrice': 435.33,
'askSize': 200,
'askId': 'P',
'lastPrice': 435.32,
'lastSize': 0,
... ,
'delayed': True,
'realtimeEntitled': False
}
)
]
)
我的代码是:
quote = c.get_quotes("SPY")
resp = quote.json().items()
print(pd.json_normalize(resp['SPY']['AskPrice'],level=2))
但是python解释器显示错误:
TypeError: 'dict_items' object is not subscriptable
我对这个简单的问题深表歉意
目前没有回答
相关问题 更多 >
编程相关推荐