ID EN
Built-in Exceptions

KeyboardInterrupt

Python 3.11

Raised when the user hits the interrupt key (normally Control-C or Delete). During execution, a check for interrupts is made regularly. The exception inherits from BaseException so as to not be accidentally caught by code that catches Exception and thus prevent the interpreter from exiting.

Syntax

PYTHON
exception KeyboardInterrupt

See Also

BaseException Exception KeyboardInterrupt KeyboardInterrupt Note on Signal Handlers and Exceptions