miércoles, 13 de julio de 2011

Remove repeated elements from a list in Python

Say we have the python list:

>>> x = [5,6,5]

to remove the duplications, use the following code snippet:


>>> x_nodups = dict(map(lambda i: (i,1),x)).keys()


Taken from the desk of stinkpot