Exception handlers handle Exceptions occur inside functions. : Exception Handle « Exception « Python






Exception handlers handle Exceptions occur inside functions.

Exception handlers handle Exceptions occur inside functions.
 



def this_fails():
     x = 1/0
 
try:
     this_fails()
 except ZeroDivisionError, detail:
     print 'Handling run-time error:', detail

           
         
  








Related examples in the same category

1.Simple exception handling exampleSimple exception handling example
2.Catch exception in a functionCatch exception in a function
3.Handling Exceptions
4.handle multiple exceptionshandle multiple exceptions
5.Demonstrates handling exceptionsDemonstrates handling exceptions