Opening files without closing them
3c273
nospam at nospam.com
Wed Mar 8 13:55:15 EST 2006
"Bryan" <belred at gmail.com> wrote in message
news:mailman.2870.1141783685.27775.python-list at python.org...
> if i really want to handle the exception, then i handle it at a
conceptually
> "higher" level by wrapping it in an exception which is basically what some
> higher-level routine would do anyways.
>
>
> try:
> f = open('file)
> try:
> # do something
> finally:
> f.close()
> except IOError:
> # handle exceptions
>
I like this idea also. Thanks to all who helped me understand..
Louis
More information about the Python-list
mailing list