Question on lists
Kristofer Pettijohn
kristofer at cybernetik.net
Wed Jul 28 02:32:14 EDT 2004
Heiko Wundram <heikowu at ceosg.de> 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.
Thanks!
--
Kristofer Pettijohn
kristofer at cybernetik.net
More information about the Python-list
mailing list