小时? 发表于 2017-5-1 07:34:51

python的字典装为json

import json
dic = {
'str': 'this is a string',
'list': ,
'sub_dic': {
'sub_str': 'this is sub str',
'sub_list':
},
'end': 'end'
}
a = json.dumps(dic)
print a


输出结果: {"sub_dic": {"sub_str": "this is sub str", "sub_list": }, "end": "end", "list": , "str": "this is a string"}
页: [1]
查看完整版本: python的字典装为json