[Tutor] List of dictionaries membership test

Norman Khine norman at khine.net
Fri Jan 2 14:17:23 CET 2009


Hello,
I have this list

 >>> currencies = [{'sign': '\xe2\x82\xac', 'id': 'EUR', 'is_selected': 
False, 'title': 'EURO'}, {'sign': '\xc2\xa3', 'id': 'GBP', 
'is_selected': True, 'title': 'Pound'}, {'sign': '$', 'id': 'USD', 
'is_selected': False, 'title': 'Dollar'}]

What is the simplest way to extract the dictionary that has key 
'is_selected'== True?


Thanks

Norman


More information about the Tutor mailing list