I have placed a list in a text file. I want python to read the text file and return the contents as a list. However, it is instead reading the content as a string:
Text file:
['a','b','c']
Python:
ids=[]writtenFile =open('file.txt')
readFile=writtenFile.read()
ids= readFile
writtenFile.close()
print ids
What is returned is ['a','b','c'] as a string, not as a list or just text. Is there a way I can retrieve ['a','b','c'] from the text file and then store this in the ids string so that ids is a list ['a','b','c'] and not the string ? "['a','b','c']"?