[Tutor] File IO

Bob Gailer bgailer at alum.rpi.edu
Tue Aug 29 23:47:36 CEST 2006


Amadeo Bellotti wrote:
> Ok im trying to create a file that the user chooses the name of and 
> print a varible that is a string to the text file. but for some reason 
> whne i do this code:
>
> FILE = open(filename, "w")
> FILE.write(puzzleanswers)
> FILE.close()
>
> it doesnt write anything 
That could mean you get an empty file or you don't see the file. Which 
is it?
If the file is empty that means puzzleanswers is  empty.
If you don't see the file that means it is being written someplace other 
than where you are looking.

-- 
Bob Gailer
510-978-4454



More information about the Tutor mailing list