Skip to content

Instantly share code, notes, and snippets.

@takaki
Created July 22, 2016 07:12
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 takaki/9ffff06dc32ee7b53aefc3bbc50de534 to your computer and use it in GitHub Desktop.
Save takaki/9ffff06dc32ee7b53aefc3bbc50de534 to your computer and use it in GitHub Desktop.
listから重複がある要素を探す ref: http://qiita.com/takaki@github/items/2db001df80f99031b326
>>> from collections import Counter
>>> [ k for k, v in Counter([0,1,2,3,2,0,4]).items() if v > 1 ]
[0, 2]
>>> [ k for k, v in Counter("abcefacc").items() if v > 1 ]
['c', 'a']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment