Defining Clean-up Actions : Try finally « Language Basics « Python






Defining Clean-up Actions

Defining Clean-up Actions



try:
     raise KeyboardInterrupt
finally:
     print 'Goodbye, world!'
 
# A finally clause is executed whether or not an exception has occurred in the try 
# clause. 


           
       








Related examples in the same category