无论如何要编写一个从 python 2.4 到 python 3 兼容的异常捕获代码?
像这样的代码:
# only works in python 2.4 to 2.7
try:
pass
except Exception,e:
print(e)
# only works in python 2.6 to 3.3
try:
pass
except Exception as e:
print(e)
无论如何要编写一个从 python 2.4 到 python 3 兼容的异常捕获代码?
像这样的代码:
# only works in python 2.4 to 2.7
try:
pass
except Exception,e:
print(e)
# only works in python 2.6 to 3.3
try:
pass
except Exception as e:
print(e)