Ask Your Question

Revision history [back]

KeyError is raised when a dictionary key is not found in the set of existing keys. It is a runtime error that occurs when a program tries to access a dictionary for a key that does not exist. KeyError is one of the built-in exceptions in Python.