I wrote a text file that contains list of integers like below
cords = [[385, 24], [695, 32], [1010, 106], [1122, 245]]
f = open('ref_points.txt', 'w')
f.write(str(cords))
f.close()
I want to read back this text file and get the list of integers. I know when we read contents, it is str, and need processing to store in list. I would like to know if there is any better and efficient way of doing it.
Thanks
json.loads(string_content)with the content of your file.