Skip to content

Instantly share code, notes, and snippets.

@Rapptz
Created March 25, 2015 03:59
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 Rapptz/1111f514926d14311d7a to your computer and use it in GitHub Desktop.
Save Rapptz/1111f514926d14311d7a to your computer and use it in GitHub Desktop.
import os
import sys
from collections import Counter
if len(sys.argv) < 2:
print('needs at least two arguments, <char set> <files>...')
characters = sys.argv[1]
counter = Counter()
for filename in sys.argv[2:]:
with open(filename) as f:
contents = f.read()
for character in characters:
counter[character] += contents.count(character)
print(counter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment