An exception in Python is an error that happens during the execution of a program. When that error occurs, Python generates an exception that can be handled, which avoids your program to crash. Exceptions are convenient in many ways for handling errors and special conditions in a program. If you have some suspicious code that may raise an exception, you can protect your program by placing the suspicious code in a try: block.