0

我正在尝试处理下面的 JSON。我正在尝试专门提取与“符号”点之一相关的数据。假设我想为“localbtcARS”符号检索“询问”。我怎么能在 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
   }
]
4

1 回答 1

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')
于 2013-09-15T01:12:34.650 回答