I have a file like this:
columns.txt
{'name': 'Well', 'id': 'Well', 'type': 'text'}
{'name': 'Type', 'id': 'Type', 'type': 'text'}
{'name': 'Pad', 'id': 'Pad', 'type': 'text'}
Now I am reading each row into a list using
columns=[]
with open('columns.txt', 'r') as f:
for line in f:
columns.append(line.rstrip())
The result is below, which is string for each item in the list.
["{'name': 'Well', 'id': 'Well', 'type': 'text'}", "{'name': 'Type', 'id': 'Type', 'type': 'text'}", "{'name': 'Pad', 'id': 'Pad', 'type': 'text'}"]
What I’d like to get is like below without quotes for each dictionary
[{'name': 'Well', 'id': 'Well', 'type': 'text'}, {'name': 'Type', 'id': 'Type', 'type': 'text'}, {'name': 'Pad', 'id': 'Pad', 'type': 'text'}]
How to do it?
Thanks