Skip to content

Instantly share code, notes, and snippets.

@ridingintraffic
Created January 8, 2019 02:51
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 ridingintraffic/9e3b88b90ccd5983e35c0ce95c420d58 to your computer and use it in GitHub Desktop.
Save ridingintraffic/9e3b88b90ccd5983e35c0ce95c420d58 to your computer and use it in GitHub Desktop.
quick and dirty one line to dedup a list
>>> all_ids = [1,2,3,4,5,1,2,7,8,3,4,5]
>>> print all_ids
[1, 2, 3, 4, 5, 1, 2, 7, 8, 3, 4, 5]
## create a set passing in the list and then returning a list
>>> deduped_ids = list(set(all_ids))
>>> print deduped_ids
[1, 2, 3, 4, 5, 7, 8]
`:mic_drop:`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment