Re: Opening files without closing them
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: Opening files without closing them

From: 3c273 <nospam@nospam.com>
Date: Wed Mar 08 2006 - 19:55:15 CET

"Bryan" <belred@gmail.com> wrote in message
news:mailman.2870.1141783685.27775.python-list@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
Received on Sun Apr 30 11:12:55 2006