Python 3 Print Exception Message

This post shows how to display the message and details on an Exception in Python 3.

Using Python 3.7.0.

Catch Specific Exception

This outputs:

Catch All Exception

This outputs similar information:

Without using the sys package

The codes above use the sys package. Alternatively, we could display the Exception message this way:

This outputs:

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert