Difference between except: and except Exception as e:

While the except Exception as e statement is much more in-depth, it does not deliver on catching exceptions like BaseException or some of the system-exiting exceptions like KeyboardInterrupt, SystemExit, and also GeneratorExit. However, a simple except statement can fulfill this task and catches all these exceptions.


The syntax for the simple except statement is:

try:
    # write code that may throw exception
except:
    # the code for handling the exception


While the syntax for the except Exception as e statement is:

try:
    # write code that may throw exception
except Exception as e:
    # the code for handling the exception