Skip to content

Exceptions

An exception allows catching issues before they occur and add special handling to them.

try:
    print(0/0)
except:
    print("All Exceptions")
All Exceptions

try:
    print(0/0)
except ZeroDivisionError:
    print("Divide by Zero Exception")
Divide by Zero Exception