I would like to know how to transform this string,
"[{'id': 453, 'name': 'Paulo'}]"
into a list, being the dictionary the first element of the list.
How can I do it?
I would like to know how to transform this string,
"[{'id': 453, 'name': 'Paulo'}]"
into a list, being the dictionary the first element of the list.
How can I do it?
Do this:
>>> from ast import literal_eval
>>>
>>>
>>> literal_eval("[{'id': 453, 'name': 'Paulo'}]")
[{'id': 453, 'name': 'Paulo'}]