[Tutor] file enigma
denis.spir at free.fr
Thu Jun 11 11:10:14 CEST 2009
text = file(filename).read()
How do you close() the file? ;-)
Is it, in fact, automagically closed after end-of-statement if not bound to a name? Or when the execution path quits the present scope (func, module), like if it had been bound to a local var? Or what else?
Said differently: in this case, how long does the python file object live / does the file in file system remain locked?
I would love case #1.
This may be implementation-dependant, no?
la vita e estrany
More information about the Tutor