Created
October 29, 2014 03:56
-
-
Save dangayle/fc2b75ca703d451c98f1 to your computer and use it in GitHub Desktop.
unique list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import OrderedDict | |
from itertools import repeat, izip | |
alist = ["a", "b", "c", "a"] | |
n = repeat(None) | |
print(list(OrderedDict(izip(alist,n)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or even better:
sorted(set(alist), key=lambda x: alist.index(x))