请问,在python 中如何将一个string 转成 list[dicts] ?

我有个string,内容如下:
str_content = '''
[
{
"Id": "Failure",
"Description": null,
"Event": [],
"RowId": 1
},
{
"Id": "Virtual",
"Description": null,
"Event": [],
"RowId": 2
},
{
"Id": "Cleaning",
"Description": null,
"Event": [],
"RowId": 3
}
]
'''
怎么可以把 str_content 转成list[dicts]
就是变成一个list,list 里面是字典格式?

回答

expected_result_converted = json.loads(expected_result) # return a list[dicts]

以上是请问,在python 中如何将一个string 转成 list[dicts] ?的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>