[Tutor] KeyError list?
wesley chun
wescpy at gmail.com
Wed Aug 15 19:20:03 CEST 2007
> Is there a comprehensive list of dictionary KeyError meanings?
>
> I could sure use one these days and haven't had much luck tracking one down yet.
can you give us an example of what you're looking for? generally:
exception KeyError:
Raised when a mapping (dictionary) key is not found in the set of existing keys
from:
http://www.python.org/doc/2.5/lib/module-exceptions.html
in other words, you tried to access an element of a dictionary with a
key that is not in that dict. using the get method [e.g.,
myDict.get(key, 'N/A')] is a better way to avoid these exceptions than
just trying to get something with myDict[key].
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
http://corepython.com
wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
More information about the Tutor
mailing list