comparing two lists and returning "position"

Paul Rubin http
Fri Jun 22 00:42:34 EDT 2007


hiro <NunezD at gmail.com> writes:
> what I need to do is compare l1 against l2 and return the "position"
> of where each object in l1 is in l2
> 
> ie: pos = 0, 2, 4

Is it September already?

from itertools import izip
pos = map(dict(izip(l2, count())).__getitem__, l1)

Heh heh heh.



More information about the Python-list mailing list