Advertisement
here2share

# remove_duplicates_in_order.py

Aug 11th, 2019
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 KB | None | 0 0
  1. # remove_duplicates_in_order.py
  2.  
  3. mylist = [1,2,9,9,2,5,4,9,3]
  4. mynewlistA = list(set(mylist))
  5. print mynewlistA
  6. mynewlistB = sorted(set(mylist), key=lambda x: mylist.index(x))
  7. print mynewlistB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement