Nov-26-2018, 03:15 AM
I have one question with my code if I couldn't find match string it will keep print not find(if your text has 10 line, and could find your match, it will print 10 times). I wish if the string does not match just print one line not found.
Example:
enter your string: sss
not found
not found
not found
not found
i wish to just print one line not find, how can i changed my code
Example:
enter your string: sss
not found
not found
not found
not found
i wish to just print one line not find, how can i changed my code
import sys substring = raw_input("enter your string : ") for line in open('POD.txt'): #if ("") in line: if substring in line: print (line) else: print ("not found")