If Dict Contains a particular key

Alex Martelli aleax at mac.com
Thu Apr 26 10:32:40 EDT 2007


John Nagle <nagle at animats.com> wrote:
   ...
>      It would be useful if there was some direct way to get the value
> associated with a key, and None if there's not one.

>From <http://www.catb.org/jargon/html/G/Guido.html>:
"""
Guido's most important attribute besides Python itself is Guido's time
machine, a device he is reputed to possess because of the unnerving
frequency with which user requests for new features have been met with
the response "I just implemented that last night..."
"""
or rather more often nowadays, as in this case, he implemented it many,
many years ago -- method get of the dict type, as others already said.


Alex



More information about the Python-list mailing list