0

I have the following string in Python:

str1 = "{1:11,2:22},{1:33,2:44}"
str1

Output:

'{1:11,2:22},{1:33,2:44}'

How can I convert str1 to a list of dicts so that the result will look like the following:

[{1:11,2:22},{1:33,2:44}]

... so that my_dict[0] will return

{1:11,2:22}

and the type of my_dict[0] will also be a Python dict (and not a string)?

edn
  • 1,981
  • 3
  • 26
  • 56

0 Answers0