I want to know the best method to get the exception messages from elements of the standard library in Python.
I have used the below code:
try:
pass
except Exception as ex:
print(ex.message)
But in some cases like socket errors, I think we have to this:
try:
pass
except socket.error as ex:
print(ex)