如何在Python 2.5中将异常分配给局部变量?

问题描述

| 在Python 2.6+中,您可以处理如下异常:
  try:
    # stuff
  except Exception as e:
    return \'exception %s\' % type(e)
2.5中的等效值是多少?     

解决方法

像这样 :
try:
    # stuff
except Exception,e:
  return \'exception %s\' % type(e)