newbie: dictionary - howto get key value

Diez B. Roggisch deetsNOSPAM at web.de
Thu Mar 10 12:38:17 EST 2005


phone = {'mike':10,'sue':8,'john':3}
print [key for key, value in phone.items() if value == 3]

-> ['john']


-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list