find a specified dictionary in a list

Odd-R. oddr at home.no.no
Fri Jul 22 07:06:45 EDT 2005


I have this list:

[{'i': 'milk', 'oid': 1}, {'i': 'butter', 'oid': 2},{'i':'cake','oid':3}]

All the dictionaries of this list are of the same form, and all the oids
are distinct. If I have an oid and the list, how is the simplest way of
getting the dictionary that holds this oid?


Thanks in advance



-- 
Har du et kjøleskap, har du en TV
så har du alt du trenger for å leve

-Jokke & Valentinerne



More information about the Python-list mailing list