# Remove duplicates from a list

 

lst = [ 10,20,30,40,50,10,40,60,70,20]

 

lst1 = dict.fromkeys(lst).keys()

lst1.sort()

print lst1

 

print

 

print [i for i in lst if i not in locals()['_[1]'].__self__]

 

 

''' Python 2.4

>>> l

[10, 20, 30, 40, 50, 10, 40, 60, 70, 20]

>>> l = [ 10,20,30,40,50,10,40,60,70,20]

>>> set(l)

set([70, 40, 10, 50, 20, 60, 30])

>>> list(set(l))

[70, 40, 10, 50, 20, 60, 30]

>>> [i for i in l if i not in locals()['_[1]']]

[10, 20, 30, 40, 50, 60, 70]

>>> sorted(list(set(l)))

[10, 20, 30, 40, 50, 60, 70]

>>> sorted(dict.fromkeys(l).keys())

[10, 20, 30, 40, 50, 60, 70]

>>>

'''