Question on lists

Kristofer Pettijohn kristofer at cybernetik.net
Tue Jul 27 23:26:54 EDT 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