LookupError

The built-in parent class of IndexError and KeyError: the errors raised when a key or index is not found.

In more detail

An except LookupError clause catches both a bad list index and a missing dictionary key. Because the first matching except clause wins, a LookupError clause placed above a KeyError clause leaves the KeyError clause unreachable.

Related terms

Taught in

References

Certification courses