开发者

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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜