Exception names

Samuel Tardieu (tardieu@valjean.enst.fr)
01 Mar 1995 16:03:59 +0100

Is there a way to catch any exception and get its content ? Mmm... Ok,
I'm unclear, let's give an example:

try:
a = 1 / 0
except ZeroDivisionError, msg:
print "Message was", msg

This will print "Message was integer division or modulo". Everything
is fine.

But how could I do something like:

try:
a = 1 / 0
except exc, msg:
print "Exception was", exc, "and message", msg

I want to be able to assign exc to the raised exception.

Is there a way to do this ?

Sam