當前位置:成語大全網 - 新華字典 - 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')