Question on lists

Kristofer Pettijohn kristofer at cybernetik.net
Wed Jul 28 05:26:54 CEST 2004


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



More information about the Python-list mailing list