try:
doSomething()
except:
pass
or
try:
doSomething()
except Exception:
pass
The difference is that the first one will also catch KeyboardInterrupt
, SystemExit
and stuff like that, which are derived directly from exceptions.BaseException
, not exceptions.Exception
.
See documentation for details:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…