import pprint
f = open('/u1/junk/shakespeare.txt', 'r')
contents = f.read()
f.close()
count = {}
# One way
#for character in contents:
#count.setdefault(character, 0)
#count[character] = count[character] + 1
# The get method for a dictionary accepts two parameters
# The first is the lookup value
# The second is the default value if there is no record
for character in contents:
count[character] = count.get(character, 0) + 1
pprint.pprint(count)