Python3 异常处理
捕获全部异常
try:
a=b
b=c
except Exception,e:
print Exception,":",e
各种异常清单
抛出异常
raise NameError('HiThere')
若想知道是否抛出了异常
>>> try:
raise NameError('HiThere')
except NameError:
print('An exception flew by!')
raise
An exception flew by!
Traceback (most recent call last):
File "", line 2, in ?
NameError: HiThere