This is what I have so far, everything I try keep stating that the file isn't open? Is there any basic way to fix this?
liNames = []
while 1 == 1:
liNames += [raw_input("Tell me a name. Type DONE(all caps) if done entering:")]
if "DONE" in liNames:
break
del liNames[-1]
print liNames
name_file = open("names.txt","w")
line = name_file.writelines(liNames)
for line in name_file:
print line
name_file.close()
"w"). You can't read from a file opened for writing. Close the file after writing to it, then open it again for reading ("r", or just omit the file-mode argument - it defaults to reading).seek()too. Better for a beginner to close the file and open it again.