Dave Hansen wrote:
> On Thu, 16 Feb 2006 12:51:24 -0800 in comp.lang.python, "SMB"
> <[EMAIL PROTECTED]> wrote:
> 
>>
>>"Jonathan Gardner" <[EMAIL PROTECTED]> wrote in message 
>>news:[EMAIL PROTECTED]
>>> codes = map(lambda x: x[0], list1)
>>> for d in list2:
>>>  if d['code'] in codes:
>>>    d['VERIFIED'] = 1
>>>
>>> Is this what you were looking for?
>>>
>>
>>That is exactly what I was looking for.  I will have to take a look at map.
> 
> You might also look at list comprehensions.  Replacing the first line
> in the above with
> 
>    codes = [x[0] for x in list1]
> 
> should yield the same result.

Even another way:

import operator
codes = map(operator.itemgetter(0), list1)

Georg
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to