Python Exceptions

try:

print ("Your Code Here")

except Exception:

print ("Code here will only execute if your code is unsuccessful")

else:

  print ("Code here will only execute if your code is successful")

finally:

  print ("Code here will always execute")

The else: and finally: clauses are optional

Custom Exceptions

class myException(Exception):

   pass


raise myException("My Exception Text")

Bibliography