In direct, my code so far is this :
from glob import glob pattern = \"D:\\\\report\\\\shakeall\\\\*.txt\" filelist = glob(pattern) def countwords(fp): w
If you want to get count of each unique word, then use dicts:
words = ['Hello', 'world', 'world'] count = {} for word in words : if word in count : count[word] += 1 else: count[word] = 1
And you will get dict
{'Hello': 1, 'world': 2}