Created
February 25, 2016 09:28
-
-
Save davidbj/af54dbe3a16c18559ee3 to your computer and use it in GitHub Desktop.
List Deduplication
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
| def list_deduplication(): | |
| """List Deduplication. | |
| """ | |
| ld = [1, 3, 2, 4, 3, 4, 2, 5, 5, 7] | |
| nld = [] | |
| [nld.append(str(i)) for i in ld if str(i) not in nld] | |
| return ','.join(nld) | |
| list_deduplication() |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
优化:
tmp=set()
[nld.append(str(i)), tmp.append(str(i)) for i in ld if str(i) not in tmp]