I have a problem with else statement. How to make the code print not found? it keep print not found
import os
f = open('D:/Workspace/snacks.txt', "r");
class line:
for line in f.readlines():
if line.find('chocolate') != -1:
print "found ", line
elif line.find('milkshake') != -1:
print "found ", line
else:
print "not found"
class line:does here. Remove it and it should work just fine. Remember to close file afterwards.