Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Catching Specific Exceptions in Python

try:
   # do something
   pass

except ValueError:
   # handle ValueError exception
   pass

except (TypeError, ZeroDivisionError):
   # handle multiple exceptions
   # TypeError and ZeroDivisionError
   pass

except:
   # handle all other exceptions
   pass
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Catching #Specific #Exceptions #Python
ADD COMMENT
Topic
Name
6+3 =