thank you all, great feedback.
Sander Sweers wrote:
2009/3/9 A.T.Hofkamp :
You can do something like
[d for d in d1 if d['is_selected'] == False]
to get your dicts.
If 'is_selected' is not always present, it gets a bit more complicated, I'll
leave that as an exercise for the interested reader
On Mon, Mar 9, 2009 at 10:28 AM, ski wrote:
> hello,
>
> i have this list which contains a number of dictionaries.
>
d1 = [{'is_selected': False, 'id': 'AAC', 'title': 'Association of
Airline Cons.'}, {'is_selected': False, 'id': 'AALA', 'title': 'Adv.
Activity Licence. Auth.'}, {'is
2009/3/9 A.T.Hofkamp :
> You can do something like
> [d for d in d1 if d['is_selected'] == False]
> to get your dicts.
>
> If 'is_selected' is not always present, it gets a bit more complicated, I'll
> leave that as an exercise for the interested reader :)
You would use d.get('is_selected', False)
ski wrote:
hello,
i have this list which contains a number of dictionaries.
>>>d1 = [{'is_selected': False, 'id': 'AAC', 'title': 'Association of
Airline Cons.'}, {'is_selected': False, 'id': 'AALA', 'title': 'Adv.
Activity Licence. Auth.'}, {'is_selected': False, 'id': 'ABPCO',
'title': 'A
hello,
i have this list which contains a number of dictionaries.
>>>d1 = [{'is_selected': False, 'id': 'AAC', 'title': 'Association of
Airline Cons.'}, {'is_selected': False, 'id': 'AALA', 'title': 'Adv.
Activity Licence. Auth.'}, {'is_selected': False, 'id': 'ABPCO',
'title': 'Association of