« Previous entry | Next entry » Browse > Snippets

Skip to comments (4) Remove dulplicate items from a list in Python
Posted by Buzzard on Nov 06 2005 @ 05:00  :: 2696 unique visits

A reletive simply process made even simplier with list compreshesion.  For bigger lists where speed is an issue, there are several different implmentations listed in this ASPN recipe

CODE: PYTHON
def uniqueList(list):
    """ Returns a list with all duplicate items removed (maintains order) """
    uniqueList = []
    [uniqueList.append(item) for item in list if item not in uniqueList]
    return uniqueList;

4 comments posted so far
Add your own »

1. On Nov 11 2005 @ 23:37 toran wrote:

<3

thanks

2. On Apr 21 2009 @ 09:46 guest wrote:

When the wolf wow gold finally found the hole Buy Wow Gold in the chimney he Cheap WoW Gold crawled down and KERSPLASH right into that kettle of water cheapest wow gold and that was the end of his troubles with the big bad wolf.

game4power,buy cheap wow gold
WOW GOLD

The next day the wow gold cheap little pig invited his mother over . She said "You see it is just as buy gold wowI told you. The way to Wow Goldget along in the world is to do things as well as you can." Fortunately for that world of warcraft gold little pig, he Cheapest wow Goldlearned that lesson. And he just lived happily ever after!

3. On Apr 21 2009 @ 09:47 guest wrote:

When the wolf wow gold finally found the hole Buy Wow Gold in the chimney he Cheap WoW Gold crawled down and KERSPLASH right into that kettle of water cheapest wow gold and that was the end of his troubles with the big bad wolf.

game4power,buy cheap wow gold
WOW GOLD

The next day the wow gold cheap little pig invited his mother over . She said "You see it is just as buy gold wowI told you. The way to Wow Goldget along in the world is to do things as well as you can." Fortunately for that world of warcraft gold little pig, he Cheapest wow Goldlearned that lesson. And he just lived happily ever after!

Add a new comment

Name:
Password: (leave empty for anonymous comment)
 
View formatting tags Comment: