get keys with the same values

Nader n.emami at gmail.com
Thu Jun 12 12:58:53 CEST 2008


Hello,

I have a dictionary and will get all keys which have the same values.

d = {('a' : 1), ('b' : 3), ('c' : 2),('d' : 3),('e' : 1),('f' : 4)}

I will something as :

d.keys(where their values are the same)

With this statement I can get two lists for this example:
l1= ['a','e']
l2=['b','d']

Would somebody tell me how I can do it?

Regards,
Nader



More information about the Python-list mailing list