In message 
<d48b70da-5384-4dc6-9527-46c6b735c...@r1g2000yqb.googlegroups.com>, gelonida 
wrote:

> I've been told, that following code snippet is not good.
> 
> open("myfile","w").write(astring) ...

I do that for reads, but never for writes.

For writes, you want to give a chance for write errors to raise an exception 
and alert the user, instead of failing silently, to avoid inadvertent data 
loss. Hence the explicit close.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to