>> I have a list of names (Names[]) and want to remove duplicate names in
>> the list.  [snip]
>>     
>
> The way I usually do this is something like:
>
> outDict = dict(map(lambda x: (x, 1), inList))
> names = outDict.keys()
> names.sort()
>   
How about this :D

# Remove duplicates from a list:
>>> L = [1,2,2,3,3,3]
>>> [x for x in L if x not in locals()['_[1]'].__self__]
[1,2,3]

[accessed at 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/204297 ]

Also, why is there now a ******SPAM***** in the subject heading?

Wonderingly,
-Luke

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to