hal*_*nen 2 python parsing json
我想解析一下
{"ticker":{"high":31.9099,"low":22.5,"vol":108468,"buy":29.61,"sell":30,"last":29.61}}
Run Code Online (Sandbox Code Playgroud)
最后得到:
last = 29.61
Run Code Online (Sandbox Code Playgroud)
但我不知道从哪里开始解析python :(
Ign*_*ams 13
>>> text = '''{"ticker":{"high":31.9099,"low":22.5,"vol":108468,"buy":29.61,"sell":30,"last":29.61}}'''
>>> json.loads(text)
{u'ticker': {u'sell': 30, u'buy': 29.609999999999999, u'last': 29.609999999999999, u'vol': 108468, u'high': 31.9099, u'low': 22.5}}
>>> json.loads(text)[u'ticker'][u'last']
29.609999999999999
Run Code Online (Sandbox Code Playgroud)
或者使用simplejson和旧版本的Python.
| 归档时间: |
|
| 查看次数: |
3533 次 |
| 最近记录: |