Python Exception Types
Errors that happen during execution are called exceptions. Python has built-in types like TypeError, ValueError, ZeroDivisionError, and FileNotFoundError. You can catch them with try-except or raise them on purpose with raise.
try:
num = int("hello")
except ValueError:
print("That's not a number!")
raise RuntimeError("Something went wrong")
Try it Yourself →