Paul Rubin wrote:
> 
> from itertools import izip
> pos = map(dict(izip(l2, count())).__getitem__, l1)

or probably less efficiently ...

 >>> l1 = [ 'abc', 'ghi', 'mno' ]
 >>> l2 = [ 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqr']
 >>> pos = [ l2.index(i) for i in l1 ]
 >>> print pos
[0, 2, 4]

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

Reply via email to