How to test if a key in a dictionary exists?

Rune Strand rune.strand at gmail.com
Sat Mar 10 16:24:34 EST 2007


Yes, you have name.has_key(name_key) and perhaps better, the in
operator:

if name_key in name:
   do something





More information about the Python-list mailing list