On 25/02/2021 01:42, Davor Levicki wrote:
i have two lists
list1 = ['01:15', 'abc', '01:15', 'def', '01:45', 'ghi' ]
list2 = ['01:15', 'abc', '01:15', 'uvz', '01:45', 'ghi' ]
and when I loop through the list
list_difference = []
for item in list1:
if item not in list2:
list_differen
On 2021-02-25 00:42, Davor Levicki wrote:
i have two lists
list1 = ['01:15', 'abc', '01:15', 'def', '01:45', 'ghi' ]
list2 = ['01:15', 'abc', '01:15', 'uvz', '01:45', 'ghi' ]
and when I loop through the list
list_difference = []
for item in list1:
if item not in list2:
list_differen
On Wed, Feb 24, 2021 at 4:45 PM Davor Levicki wrote:
>
> i have two lists
>
> list1 = ['01:15', 'abc', '01:15', 'def', '01:45', 'ghi' ]
> list2 = ['01:15', 'abc', '01:15', 'uvz', '01:45', 'ghi' ]
>
> and when I loop through the list
>
>
> list_difference = []
> for item in list1:
>
> if item no
i have two lists
list1 = ['01:15', 'abc', '01:15', 'def', '01:45', 'ghi' ]
list2 = ['01:15', 'abc', '01:15', 'uvz', '01:45', 'ghi' ]
and when I loop through the list
list_difference = []
for item in list1:
if item not in list2:
list_difference.append(item)
and I managed to get the di
On 3/5/2010 3:05 AM, jimgardener wrote:
hi
I have two lists of names.I need to find the difference between these
two lists.I tried to do it using sets.But I am wondering if there is a
better way to do it.Please tell me if there is a more elegant way.
thanks,
jim
my code snippet follows..
oldlst
2010/3/5 jimgardener :
> hi
> I have two lists of names.I need to find the difference between these
> two lists.I tried to do it using sets.But I am wondering if there is a
> better way to do it.Please tell me if there is a more elegant way.
> thanks,
> jim
>
> my code snippet follows..
>
> oldlst=
hi
I have two lists of names.I need to find the difference between these
two lists.I tried to do it using sets.But I am wondering if there is a
better way to do it.Please tell me if there is a more elegant way.
thanks,
jim
my code snippet follows..
oldlst=['jon','arya','ned','bran']
newlst=['jaim
On 29 ene, 22:47, Zbigniew Braniecki <[EMAIL PROTECTED]>
wrote:
> The new one is of course much better and cleaner (the old one is
> bloated), but I'm wondering if there is a faster way to compare two
> lists and find out what was added, what was removed, what was changed.
> I can simply iterate t
[EMAIL PROTECTED] wrote:
> Zbigniew Braniecki:
>> Is there a way to speed it up? Any easier way? Faster method?
>
> This problem is a bit messy. Maybe it's better to sidestep the
> problem, and not use a list, and create an object that wraps the list,
> so it always keeps an updated record of what
Zbigniew Braniecki:
> Is there a way to speed it up? Any easier way? Faster method?
This problem is a bit messy. Maybe it's better to sidestep the
problem, and not use a list, and create an object that wraps the list,
so it always keeps an updated record of what changes are done... but
you have to
Hi all.
I'm working on a tool for localizers.
I have two Lists with Entities/Strings/Comments (each L10n file is built
of those three elements).
So I have sth like:
l10nObject = []
l10nObject.append(Comment('foo'))
l10nObject.append("string")
l10nObject.append(Entity('name', 'value'))
etc. I
I have learnt a lot from your example and used it for my purpose.
Thank you, it very helped me.
Lada
Peter Otten wrote:
> Ladislav Andel wrote:
>
>
>> need to be stopped before deleting any instance from items.
>> So I need to call stopLoop method in the given item in items before it
>> gets re
Ladislav Andel wrote:
> need to be stopped before deleting any instance from items.
> So I need to call stopLoop method in the given item in items before it
> gets removed.
> If there is any addition to items it's quite easy to call
> item.startLoop() method.
Unless you want to rely on the __del_
Peter Otten wrote:
> Ladislav Andel wrote:
>
>
>> Peter Otten wrote:
>>
>>> Ladislav Andel wrote:
>>>
>>>
>>>
what would be the most efficient way to do following?
I have a list of dictionaries taken from DB e.g.
dblist = [{'id:1, 'host':'google.com','ip_addre
Peter Otten wrote:
> Ladislav Andel wrote:
>
>
>> Peter Otten wrote:
>>
>>> Ladislav Andel wrote:
>>>
>>>
>>>
what would be the most efficient way to do following?
I have a list of dictionaries taken from DB e.g.
dblist = [{'id:1, 'host':'google.com','ip_addre
Ladislav Andel wrote:
> Peter Otten wrote:
>> Ladislav Andel wrote:
>>
>>
>>> what would be the most efficient way to do following?
>>>
>>> I have a list of dictionaries taken from DB e.g.
>>> dblist = [{'id:1, 'host':'google.com','ip_address':'1.2.3.4'},
>>> {'id:3, 'host':'yahoo.com','ip_add
Well, I know it's quite ugly what I did to the code, but any
improvements are welcome.
Actually, it doesn't work as it should yet.
The items should stay the same as at the beginning.
I say in one sentence what I want to achieve:
Synchronized items with dblist.
It should remove hosts from items whi
Peter Otten wrote:
> Ladislav Andel wrote:
>
>
>> what would be the most efficient way to do following?
>>
>> I have a list of dictionaries taken from DB e.g.
>> dblist = [{'id:1, 'host':'google.com','ip_address':'1.2.3.4'},
>> {'id:3, 'host':'yahoo.com','ip_address':'5.6.7.8'},
>> {'id:9, 'hos
Ladislav Andel wrote:
> what would be the most efficient way to do following?
>
> I have a list of dictionaries taken from DB e.g.
> dblist = [{'id:1, 'host':'google.com','ip_address':'1.2.3.4'},
> {'id:3, 'host':'yahoo.com','ip_address':'5.6.7.8'},
> {'id:9, 'host':'msn.com','ip_address':'11.3.
On Aug 23, 2007, at 11:27 AM, Ladislav Andel wrote:
> Hi,
> what would be the most efficient way to do following?
>
> I have a list of dictionaries taken from DB e.g.
> dblist = [{'id:1, 'host':'google.com','ip_address':'1.2.3.4'},
> {'id:3, 'host':'yahoo.com','ip_address':'5.6.7.8'},
> {'id:9, '
[EMAIL PROTECTED] wrote:
> On Aug 23, 11:27 am, Ladislav Andel <[EMAIL PROTECTED]> wrote:
>
>> Hi,
>> what would be the most efficient way to do following?
>>
>> I have a list of dictionaries taken from DB e.g.
>> dblist = [{'id:1, 'host':'google.com','ip_address':'1.2.3.4'},
>> {'id:3, 'host':
On Aug 23, 11:27 am, Ladislav Andel <[EMAIL PROTECTED]> wrote:
> Hi,
> what would be the most efficient way to do following?
>
> I have a list of dictionaries taken from DB e.g.
> dblist = [{'id:1, 'host':'google.com','ip_address':'1.2.3.4'},
> {'id:3, 'host':'yahoo.com','ip_address':'5.6.7.8'},
>
Hi,
what would be the most efficient way to do following?
I have a list of dictionaries taken from DB e.g.
dblist = [{'id:1, 'host':'google.com','ip_address':'1.2.3.4'},
{'id:3, 'host':'yahoo.com','ip_address':'5.6.7.8'},
{'id:9, 'host':'msn.com','ip_address':'11.3.2.3'}]
and list of object in
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
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
> o
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 d
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 mi
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)
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 s
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',
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
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
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
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.
--
http://mail
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 i
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
--
http
36 matches
Mail list logo