open.read

David Bear david.bear at asu.edu
Wed Aug 20 22:35:54 CEST 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