I have a string ouput which looks like below
result = "[(u'Delhi', 20199330), (u'Mumbai', 134869470), (u'Kolkata', 6678446)]"
Now I want to convert it to a regular array. So this is what I do
import json
print(json.loads(result))
But I get the following error
ValueError: No JSON object could be decoded
Now I know result
is not a json
. But python does convert a string list into a regular list by doing something like
some_list = "[10, 20, 30]"
print(json.loads(some_list))
So I was hoping it would convert my result
which is a string list of tuples into a regular list of tuples. But it throws error.
How can I convert result
into a regular list?