[python] using try: finally: except

Miki Tebeka miki.tebeka at zoran.com
Sun Jun 20 04:29:17 EDT 2004


Hello David,

> In referring to my copy of the python bible, it tells me I can't use all 
> three items 'try' except and finally.  I can use the t/f or t/e  
> combinations though
> 
> What combination can i use if i want to catch the exception and still have 
> a finally block?
try:
    try:
        do_something()
    except Exception, e:
        print "bummer"
finally:
    print "at last"

Google this list for why you can't have try/except/finally together.

HTH.
--
-------------------------------------------------------------------------
Miki Tebeka <miki.tebeka at zoran.com>
The only difference between children and adults is the price of the toys.




More information about the Python-list mailing list