when should I explicitely close a file?
gelonida at gmail.com
Wed Apr 14 00:01:25 CEST 2010
I've been told, that following code snippet is not good.
open("myfile","w").write(astring) , because I'm neither explicitely
closing nor using the new 'with' syntax.
What exactly is the impact of not closing the file explicitely
(implicitley with a 'with' block)?
Even with my example
I'd expected to get an exception raised if not all data could have
I'd also expected, that all write data is flushed as soon as the
filehandle is out of scope (meaning in the next line of my source
Thanks for explaining me exactly what kind of evil I could encounter
with not explicitely closing.
More information about the Python-list