I would like to read this txt file and get a list of dictionaries in python:
data.txt:
[{"name": "Aaron", "age": "1"}, {"name": "Bruce", "age": "2"}]
Whereas:
with open('data.txt','r') as f:
list_of_dict = f.read()
print(list_of_dict[0])
Prints --> {"name": "Aaron", "age": "1"}
print(list_of_dict[1])
Prints --> {"name": "Bruce", "age": "2"}
print(type(list_of_dict[1])
Prints --> dict
print(type(list_of_dict)
Prints --> list
Thank you