Skip to content

Instantly share code, notes, and snippets.

@ZhouYang1993
Created September 26, 2022 21:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZhouYang1993/e736cc7d65a7f6ef57dbf8404caec748 to your computer and use it in GitHub Desktop.
Save ZhouYang1993/e736cc7d65a7f6ef57dbf8404caec748 to your computer and use it in GitHub Desktop.
Counter in Python
from collections import Counter
author = "Yang Zhou"
chars = Counter(author)
print(chars)
# Counter({'Y': 1, 'a': 1, 'n': 1, 'g': 1, ' ': 1, 'Z': 1, 'h': 1, 'o': 1, 'u': 1})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment