how to count lines in a file ?
Michele Simionato
mis6 at pitt.edu
Thu Jul 25 10:31:51 EDT 2002
Can somebody provide a simple example where the idiom
file(name,'w').write(something)
fails, in the sense that the file is not closed or something is not written ?
I tried to hang the program with a memory overload
file(name,'w').write(something)
for i in range(2*10**8): pass
(this doesn't crash my machine but the CTRL-C doesn't work and I have to
kill the precess by hand) but still at the end something is written in the
file name. How safe is Python implicit file closing ? In which practical
situations can fail and how dangerous can be ?
--
Michele Simionato - Dept. of Physics and Astronomy
210 Allen Hall Pittsburgh PA 15260 U.S.A.
Phone: 001-412-624-9041 Fax: 001-412-624-9163
Home-page: http://www.phyast.pitt.edu/~micheles/
More information about the Python-list
mailing list