> I want to search list1, and the result should be all dictionaries where
> primarycolor is in input. I can do this using a double for-loop, but is
> there a more efficent way?
Of course. :-)
L = [dict for dict in list1 if dict['primarycolor'] in input]
In older versions of Python, we would use the "filter" function, which
accomplishes the same thing.
--
[Mozilla] Firefox is better than Explorer by leaps and bounds. I
don't miss Explorer one iota. Give Firefox a day's worth of Web
surfing, and you won't either.
- Forbes (short link: http://tinyurl.com/56j8m )
--
http://mail.python.org/mailman/listinfo/python-list