I want to find out the frequency of a specific word from a text file. Suppose in my document i have a line "this is me is is " if i input 'is' the output should 3 if my input is 'me' output should 1. i am trying this code
import re
doc1 = re.findall(r'\w+', open('E:\doc1.txt').read().lower())
words = raw_input("Input Number :: ")
docmtfrequency1 = words.count(words)
but it is not giving desired output
doc1.count(words).words.count(words)supposed to do?