Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # only_remove_duplicates.py
- old = [99, 0, 5, 5, 4, 3, 5, 3, 2, 1]
- new = list(dict.fromkeys(old).keys())
- print(new, 'fromkeys(~) maintains the order')
- # rather than...
- new = list(set(old))
- print(new, 'set(~) has changed the order')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement