I have a file from which I need to extract the particular dictionary value
Data is in below format in file:
{'name': 'xyz', 'age': 14, 'country': 'india'}
My code:
var = 'country'
with open('abc.txt', 'r') as fw:
    first_line = fw.readline()
    dictvalue = first_line[var]
    print(dictvalue)
But this is not fetching value : india, it is throwing error: string indices must be integer
 
     
    