Python中解析json字符串

来源:互联网 发布:买家淘宝违法规则 编辑:程序博客网 时间:2024/05/29 15:14
import json#注意:内容的外部使用单引号, 内容内部使用双引号content = '{"user":"walter", "pwd":"123"}'#deserialize a json string to a python dict typejdict = json.loads(content)    #the type of jdict is dictprint jdict["user"]print jdict["pwd"]