import json
#注意:内容的外部使用单引号, 内容内部使用双引号
content = '{"user":"walter", "pwd":"123"}'
#deserialize a json string to a python dict type
jdict = json.loads(content) #the type of jdict is dict
print jdict["user"]
print jdict["pwd"]
Python中解析json字符串
最新推荐文章于 2024-05-28 17:36:35 发布