Python - Custom Exceptions
You want to catch all exceptions except
KeyboardInterrupt and SystemExit. Which is the best way to write the except block?KeyboardInterrupt and SystemExit. Which is the best way to write the except block?KeyboardInterrupt and SystemExit inherit directly from BaseException, not Exception.except Exception: catches all exceptions except KeyboardInterrupt and SystemExit, which is the desired behavior.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions