Question on lists

Kristofer Pettijohn kristofer at
Wed Jul 28 08:32:14 CEST 2004

Heiko Wundram <heikowu at> wrote:
>>>> import sets
>>>> list(sets.Set(['a','a','b','b','d','b','c','a','ladida']))
> ['a', 'c', 'b', 'd', 'ladida']
> This doesn't maintain the order of the items, though. If you need that, and 
> you're sure your list is always sorted, use the example Andrew gave.

Good to know for the future; unfortunately these needed to remain
in order - I'm graphing routes and paths, and if the same node shows
up 2+ times in a row, I needed them weeded out.


Kristofer Pettijohn
kristofer at

More information about the Python-list mailing list