成语大全网 - 汉语词典 - python文本创建词典

python文本创建词典

如果字符串能够修改为下面这种,就可以直接json处理:

import json

s = '''{"id1": 1, "name1": "张三", "description1": "mmmmmm", "id2": 2, "name2": "李四", "description2": "NNNNNNN", "id3": 3, "name3": "王五", "description3": "TTTTT"}'''

print json.loads(s,encoding='UTF-8')