hiro wrote:
bare in mind that I have a little over 10 million objects in my list
(l2) and l1 contains around 4 thousand
objects.. (i have enough ram in my computer so memory is not a
problem)
Glad to see you solved the problem with the trailing space.
Just one minor point, I did say
or
Charles Sanders [EMAIL PROTECTED] writes:
from itertools import izip, count
d = dict(izip(l2,count()))
pos = [ d[i] for i in l1 ]
or the more memory intensive
d = dict(zip(l2,range(len(l2
pos = [ d[i] for i in l1 ]
If you're itertools-phobic you could alternatively write
d =
On Jun 22, 1:46 am, Charles Sanders [EMAIL PROTECTED]
wrote:
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 = [
On Fri, 22 Jun 2007 03:11:16 +, hiro wrote:
Hi there, I have a 2 lists.. for simplicities sake lets say the are:
l1 = [ 'abc' 'ghi' 'mno' ]
l2 = [ 'abc' 'def' 'ghi' 'jkl 'mno' 'pqr']
what I need to do is compare l1 against l2 and return the position of
where each object in l1 is in
On Jun 22, 2:16 am, hiro [EMAIL PROTECTED] wrote:
On Jun 22, 1:46 am, Charles Sanders [EMAIL PROTECTED]
wrote:
Paul Rubin wrote:
from itertools import izip
pos = map(dict(izip(l2, count())).__getitem__, l1)
or probably less efficiently ...
l1 = [ 'abc', 'ghi', 'mno' ]
l2 =
In [EMAIL PROTECTED], hiro wrote:
Hi once again, Charles.. I have tried your approach in my data set l2
and it keeps crashing on me,
bare in mind that I have a little over 10 million objects in my list
(l2) and l1 contains around 4 thousand
objects.. (i have enough ram in my computer so
On Jun 22, 1:56 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
In [EMAIL PROTECTED], hiro wrote:
Hi once again, Charles.. I have tried your approach in my data set l2
and it keeps crashing on me,
bare in mind that I have a little over 10 million objects in my list
(l2) and l1
On Jun 22, 1:58 pm, hiro [EMAIL PROTECTED] wrote:
On Jun 22, 1:56 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
In [EMAIL PROTECTED], hiro wrote:
Hi once again, Charles.. I have tried your approach in my data set l2
and it keeps crashing on me,
bare in mind that I have a
On Jun 22, 2:00 pm, hiro [EMAIL PROTECTED] wrote:
On Jun 22, 1:58 pm, hiro [EMAIL PROTECTED] wrote:
On Jun 22, 1:56 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
In [EMAIL PROTECTED], hiro wrote:
Hi once again, Charles.. I have tried your approach in my data set l2
and it
On 2007-06-22, hiro [EMAIL PROTECTED] wrote:
Hi there, I have a 2 lists.. for simplicities sake lets say the are:
l1 = [ 'abc' 'ghi' 'mno' ]
l2 = [ 'abc' 'def' 'ghi' 'jkl 'mno' 'pqr']
what I need to do is compare l1 against l2 and return the position
of where each object in l1 is in l2
hiro [EMAIL PROTECTED] 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.
--
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
--
Hi there, I have a 2 lists.. for simplicities sake lets say the are:
l1 = [ 'abc' 'ghi' 'mno' ]
l2 = [ 'abc' 'def' 'ghi' 'jkl 'mno' 'pqr']
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
Thanks in advance, -h
--
13 matches
Mail list logo