How do you assign an exception to a local variable in Python 2.5?
In Python 2.6+, you can handle exceptions like this:
try:
# stuff
except Exception as e:
re开发者_JAVA百科turn 'exception %s' % type(e)
What is the equivalent in 2.5?
Like this :
try:
# stuff
except Exception, e:
return 'exception %s' % type(e)
精彩评论