What I'm trying to do is check if this line is found in a text file. If so, I want it to print this line, otherwise print the message.
I have already implemented this code:
def check_string(string): w = raw_input("Input the English word: ") if w in open('example.txt').read(): for w.readlines(): print line else: print('The translation cannot be found!')
I tried to implement this, but got a syntax error.
It says:
invalid syntax in string - for w.readlines ():
Any idea on how to go with this line of code?
source share