异常处理简单例子--python except Exception as e
捕获所有异常
#!/usr/bin/python
a = 10
b = 0
try:
c = a/b
print c
print 'nothing happen...'
#todo: catch all exception
except Exception,e:
print 'bad sth happen...',Exception,":",e
用一个例子来演示会更加清晰

浙公网安备 33010602011771号