Is there a buildin(or 3rd party) function in Python to get the exception
caught in context?
Is there a function in Python, e.g. get_exception, so I can do this:
try:
can_raise_anything()
except:
ex = *get_exception()*
print('caught something: ' + str(ex))
I know in Python 3, I should use except BaseException as ex: to do the
task. I'm just curious to see if there is a function can do that.
No comments:
Post a Comment