I have a txt
file. I wrote some code to search the file for 'Monday'
and provided a counter to check how many times 'Monday'
is found in the file.
I would like to ask the question 'what do you want to search for?'
and allow the end user to input a word. Then, the code should find out how many times their desired word appears in the file.
print('what do you want to search for?')
name = input()
count=0
f=open('/Users/z007881/Documents/days.txt','r')
findit=f.readlines()
for line in findit:
if "input" in line:
count=count+1
print (count)
f.close()