open.read

David Bear david.bear at asu.edu
Wed Aug 20 16:35:54 EDT 2003


I was in a hurry to do something and I did

stuff = open("filename", "r").read()

then I realized, "hey I didn't close the file".

so python close it automagically?  Since I was doing python
interactively I expect the interpreter closed the file for me but my
guess is the above syntax is probably poor.  any comments?





More information about the Python-list mailing list