I want to take every word from a text file, and count the word frequency in a dictionary.
Example: \'this is the textfile, and it is used to take words and co
\'this is the textfile, and it is used to take words and co
One more function:
def wcount(filename): counts = dict() with open(filename) as file: a = file.read().split() # words = [b.rstrip() for b in a] for word in a: if word in counts: counts[word] += 1 else: counts[word] = 1 return counts