[python] using try: finally: except
russblau at hotmail.com
Thu Jun 17 23:07:08 CEST 2004
"David Stockwell" <winexpert at hotmail.com> wrote in message
news:mailman.30.1087503791.18066.python-list at python.org...
> 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
> finally block?
> This is a fictional example of what I want....
> x = 'hello'
> except Exception, e:
> print "oops"
> y = 'world'
> print x," ", y
x = 'hello'
except Exception, e:
y = 'world'
print x," ", y
Of course, in your example it doesn't matter because the 'except' clause
doesn't stop execution from passing to the next line, but if you were doing
something more fatal in the 'except' clause then (I think) you would still
execute the 'finally' block.
I don't actually read my hotmail account, but you can replace hotmail with
excite if you really want to reach me.
More information about the Python-list