Skip to content

Instantly share code, notes, and snippets.

@Rapptz

Rapptz/luccount.py

Created Mar 25, 2015
Embed
What would you like to do?
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