key not found in dictionary

Pierre Quentel quentel.pierre at wanadoo.fr
Tue Aug 22 15:33:15 EDT 2006


Depending on what you want to do if the key doesn't exist, you might
want to use the dictionary method get() :

    value = some_dict.get(key,default)

sets value to some_dict[key] if the key exists, and to default
otherwise

Regards,
Pierre




More information about the Python-list mailing list