Question on lists

Dan dan at eloff.info
Wed Jul 28 07:24:20 CEST 2004


I've got a SortedList class I wrote with a unique() member function that
does just this. I'm going to post it to the Python cookbook soon. If
you're interested I can send along a copy.

-Dan

-----Original Message-----
From: python-list-bounces+dan=eloff.info at python.org
[mailto:python-list-bounces+dan=eloff.info at python.org] On Behalf Of
Kristofer Pettijohn
Sent: Tuesday, July 27, 2004 8:27 PM
To: python-list at python.org
Subject: Question on lists

My question is about lists:

Is there a way to remove duplicate items from a list that are
next to each other?

Example...

Performing the operation on ['a', 'b', 'c', 'c', 'd', 'd', 'd', 'e']
will return ['a', 'b', 'c', 'd', 'e']

Performing the operation on ['a', 'b', 'c', 'c', 'd', 'c', 'd', 'e']
will return ['a', 'b', 'c', 'd', 'c', 'd', 'e']

I'm guessing there is probably nothing internal that will do it, so
I may have to write something on my own - just thought I'd check
first ;)

Thanks!

-- 
Kristofer Pettijohn
kristofer at cybernetik.net
-- 
http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list