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.
>
> Regards,
>                                         -=Dave
>
> --
> Change is inevitable, progress is not.


What about :

A = [ a[0] for a in LIST1 ]
for d in [ d for d in LIST2 if d['code'] in A ]:
    d['VERIFIED'] = 1

?

Gerard

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

Reply via email to