Created
December 18, 2011 21:18
-
-
Save ramalho/1494494 to your computer and use it in GitHub Desktop.
Using counter (from Christian Perone, with listcomp instead of filter)
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 Counter | |
| l = Counter([1,2,3,3,3,4]) | |
| co = filter(lambda n: l[n]==1 , l) | |
| ct = [n for n in l if l[n]==1] | |
| assert co == ct |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment