Nice! Thank you.

Curious as to why this happens though...

list1 = ['1','1','2','3','4']
list2 = list(set(list1))
list2
['1', '3', '2', '4'] <-- here the order has changed.

This doesn't matter for my program, its just for a script that takes excel
columns and posts them into a given SQL db column...

On 11/30/06, Python <[EMAIL PROTECTED]> wrote:

On Thu, 2006-11-30 at 12:51 -0800, Chris Hengge wrote:
> Anyone point me to something more efficient then
>
list2 = list(set(list1))

Older Pythons will force you to import sets and use sets.Set

> for item in list1:
>      if item not in list2:
>            list2.append()
>
> This just seems to take a bit a time when there are thousands or
> dozens of thousands of records just to filter out the dozen or so
> copies..
>
> Thanks.
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Lloyd Kvam
Venix Corp


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to