Python解析json字符串
{"status":0,"result":{"location":{"lng":116.47847460177,"lat":39.922450422051},"precise":0,"confidence":50,"level":""}}
使用Python中的json模块解析上一段json字符串。
首先引用json模块:
import json
data='{"status":0,"result":{"location":{"lng":116.47847460177,"lat":39.922450422051},"precise":0,"confidence":50,"level":""}}' jdata=json.loads(data) #获取对象中的属性 status=data["status"]