Catch exception in a function : Exception Handle « Exception « Python






Catch exception in a function

Catch exception in a function
 


def doNotRaiseException():
   try:
      print "In doNotRaiseException"
   finally:
      print "Finally executed in doNotRaiseException"
   print "End of doNotRaiseException"

print "Calling doNotRaiseException"
doNotRaiseException()

           
         
  








Related examples in the same category

1.Simple exception handling exampleSimple exception handling example
2.Handling Exceptions
3.handle multiple exceptionshandle multiple exceptions
4.Demonstrates handling exceptionsDemonstrates handling exceptions
5.Exception handlers handle Exceptions occur inside functions. Exception handlers handle Exceptions occur inside functions.