Skip to content

Instantly share code, notes, and snippets.

@chriszf
Created March 9, 2013 00:07
Show Gist options
  • Save chriszf/5121546 to your computer and use it in GitHub Desktop.
Save chriszf/5121546 to your computer and use it in GitHub Desktop.
letter count
def count(filename):
f = open(filename)
text = f.read()
text.lower()
letters = [0] * 26
for letter in text:
index = ord(letter) - ord("a")
if index >= 0 and index < 26:
letters[index] += 1
return letters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment