Anonymous file closing

Sergey Krushinsky skru at
Fri Jun 11 15:41:51 CEST 2004

Peter Hansen wrote:

> Duncan's response says it all, but here's the solution
> if you don't like the uncertainty inherent in the above:
> f = open(filename, 'r')
> try:
>     text =
> finally:
>     f.close()
But the uncertainty remains in case of an anonymous file, doesn't it?


More information about the Python-list mailing list