python解析json文件
import jsonf = 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]