As of right now, I have a function to replace the countChars function,
def countWords(lines):
wordDict = {}
for line in lines:
wordList = lines.split
Here a possible solution, not as elegant as ninjagecko's but still:
from collections import defaultdict
dicto = defaultdict(int)
with open('yourfile.txt') as f:
for line in f:
s_line = line.rstrip().split(',') #assuming ',' is the delimiter
for ele in s_line:
dicto[ele] += 1
#dicto contians words as keys, word counts as values
for k,v in dicto.iteritems():
print k,v