try:
doSomething()
except:
pass
或
try:
doSomething()
except Exception:
pass
区别在于,第一种也会捕捉到 KeyboardInterrupt, SystemExit之类,它直接来自 exceptions.BaseException而不是 exceptions.Exception.
try:
doSomething()
except:
pass
或
try:
doSomething()
except Exception:
pass
区别在于,第一种也会捕捉到 KeyboardInterrupt, SystemExit之类,它直接来自 exceptions.BaseException而不是 exceptions.Exception.
转载于:https://my.oschina.net/tasker/blog/872573