To count the number of occurrences of a specific word in a text file, read the content of text file to a string and use String.count() function with the word passed as argument to the count() function.
Syntax:
n = String.count(word)
where word is the string, and count() returns the number of occurrences of word in this String.
So you can read the file and make use of count() method.
#get file object reference to the file
with open("file.txt", "r") as file:
#read content of file to string
data = file.read()
words = ['apple', 'orange']
for word in words:
print('{} occurred {} times.'.format(word, data.count(word)))
Hopefully, this should work fine.
Note:
You can even loop through each and every word and increment the counter. But using a high-level programming language like Python, it would be beneficial to make use of such built-in methods.