Anonymous user
Exceptions: Difference between revisions
→Handling an exception
Line 664:
{{works with|Python|2.5}}
try-except
<lang python>try:
Line 671:
print se.args
bar()
finally:▼
baz()▼
else:
# no exception occurred
quux()
▲finally:
▲ baz()</lang>
Before Python 2.5 it was not possible to use finally and except together. (It was necessary to nest a separate ''try''...''except'' block inside of your ''try''...''finally'' block).
Line 686:
print(se.args)
bar()
finally:▼
baz()▼
else:
# no exception occurred
quux()
▲finally:
▲ baz()</lang>
=={{header|Raven}}==
|