B
Benjamin Georgi
Hello list,
I could use some help extracting the keys/values of a list of
dictionaries from a string that is just the str() representation of the
list (the problem is related to some flat file format I'm using for file
IO).
Example:'[{0: [2], 1: []}, {0: [], 1: [], 2: []}, {0: [1, 2]}]'
Then, what I want to do is to reconstruct dict_list given s.
Now, one possible solution would be
but since the content of s cannot be blindly trusted I`d rather not do
it that way. Basically my question is whether there is another solution
which is simpler than using regular expressions.
Best,
Benjamin
I could use some help extracting the keys/values of a list of
dictionaries from a string that is just the str() representation of the
list (the problem is related to some flat file format I'm using for file
IO).
Example:'[{0: [2], 1: []}, {0: [], 1: [], 2: []}, {0: [1, 2]}]'
Then, what I want to do is to reconstruct dict_list given s.
Now, one possible solution would be
but since the content of s cannot be blindly trusted I`d rather not do
it that way. Basically my question is whether there is another solution
which is simpler than using regular expressions.
Best,
Benjamin