try:
0/0
except Exception as e:
print(e)
The above code prints division by zero as one would expect. But if we try to print without creating the alias:
try:
0/0
except Exception:
print(Exception)
It simply prints <class 'Exception'>. What is happening here? The as keyword is used to create an "alias". If the error message "division by zero" is an attribute of the Exception class, then why does creating an alias make it equal to said attribute?
Is it possible to print the error message without creating the alias?