On Tue, 2007-05-15 at 23:17 -0700, [EMAIL PROTECTED] wrote:
> Hi,
>      Suppose i have a list v which collects some numbers,how do i
> remove the common elements from it ,without using the set() opeartor.
>                                                       Thanks

If the list is sorted, you can weed out the duplicates with
itertools.groupby:

>>> import itertools
>>> L = [1,2,3,3,4,4,5]
>>> [k for (k,_) in itertools.groupby(L, lambda x:x)]
[1, 2, 3, 4, 5]

HTH,

-- 
Carsten Haese
http://informixdb.sourceforge.net


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

Reply via email to