I have a file output.txt
who's contents are already in a python dictionary format:
output.txt = {'id':123, 'user': 'abc', 'date':'20-08-1998'}
When I read the file into python I get the following:
f = open('output.txt','r', encoding='utf8')
print(f)
>>> <_io.TextIOWrapper name='output.txt' mode='r' encoding='utf8'>
How can I read the file in as a python dictionary?
I have tried to use the dict()
constructor, but I get this error:
f = dict(open('output.txt','r', encoding='utf8'))
ValueError: dictionary update sequence element #0 has length 15656; 2 is required