Last active
December 17, 2018 09:27
-
-
Save kitten77/2ca469ebfd3314c47132331dfa5f0dd9 to your computer and use it in GitHub Desktop.
quick collection counter
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
import collections | |
string = "aaaBBBcccDDD" | |
line = str() | |
counter = collections.Counter(string) | |
for key, value in counter.items(): | |
line +=(f'{key}: {value} ') | |
print(line) |
Author
kitten77
commented
Dec 17, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment