我正在尝试处理下面的JSON。我正在尝试专门提取与“符号”点之一相关的数据。假设我想要检索'localbtcARS'符号的'ask'。我怎么能用Python做到这一点?
[
{
"volume":3.610000000000,
"latest_trade":1379188723,
"bid":1000.000000000000,
"high":970.430000000000,
"currency":"ARS",
"currency_volume":3503.252300000000,
"ask":774.310000000000,
"close":970.430000000000,
"avg":970.43,
"symbol":"localbtcARS",
"low":970.430000000000
},
{
"volume":0,
"latest_trade":1349296271,
"bid":null,
"high":null,
"currency":"AUD",
"currency_volume":0,
"ask":null,
"close":14.000000000000,
"avg":null,
"symbol":"bitmarketAUD",
"low":null
}
]
答案 0 :(得分:3)
这是json
模块派上用场的地方:
import json
res = """the_list_of_dictionaries_posted_above_"""
mylist = json.loads(res)
for d in mylist:
if d.get('symbol') == 'localbtcARS':
print d.get('ask')