June 2017
Beginner
352 pages
8h 39m
English
A KeyError is raised when a look-up in a mapping fails.
You can see that here when we look up a non-existent key in a dict:
>>> codes = dict(gb=44, us=1, no=47, fr=33, es=34)>>> codes['de']Traceback (most recent call last): File "<stdin>", line 1, in <module> KeyError: 'de'
Read now
Unlock full access