Skip to content

Instantly share code, notes, and snippets.

@apackeer
Created September 30, 2012 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apackeer/3806099 to your computer and use it in GitHub Desktop.
Save apackeer/3806099 to your computer and use it in GitHub Desktop.
Remove Duplicates from an array
def remDuplicates(arr):
returnme = []
for i in arr:
if not i in returnme:
returnme.append(i)
return returnme
# Example:
# remDuplicates(["test", "test1", "test2", "test", "test2"]) -> ["test", "test1", "test2"]
@apackeer
Copy link
Author

Also, could add it to a set and then back again...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment