2 years ago
#19318
henriksen
How can I count every word from a table in a .txt file
I have a table of words and I would like to count how many times these words occur in a .txt file.
So far I have written the word I want to be counted in the file like this:
word = 'sustainable'
word_count = file.count(word)
print('Number of occurences of the word', word, ': ', word_count)
But then I would have to write every single word I want to be counted.
python
word-count
0 Answers
Your Answer