Say I have a text file containing entries, and I want to count the number of entries which have the word "apple" in them.
I have tried the following code, anyone knows what would help? learning python.
-->
-->
thank you
I have tried the following code, anyone knows what would help? learning python.
-->
Code:
#!/usr/local/bin/python
file = open("C:/Users/xyzl/Desktop/fruit.txt","r") #Open File.
def appleno(fruit):
res = 0
for (apple) in auth:
res = res+1
return res
thank you
Comment