发表于 2017-5-1 07:37:57

python解析json文件

import json
f = file("2.json");
s = json.load(f)
print s['end']
print s['sub_dic']['sub_str']
f.close


2.json的文件内容

{"sub_dic": {"sub_str": "this is sub str", "sub_list": }, "end": "end", "list": , "str": "this is a string"}


结果:
end
this is sub str
页: [1]
查看完整版本: python解析json文件