Basically, I have to check whether a particular pattern appear in a line or not. If yes, I have to print that line otherwise not. So here is my code:
p = input()
while 1:
line = input()
a=line.find(p)
if a!=-1:
print(line)
if line=='':
break
This code seems to be good and is being accepted as the correct answer. But there's a catch. I'm getting a run time error EOFError: EOF when reading a line which is being overlooked by the code testing website.
I have three questions:
1) Why it is being overlooked?
2) How to remove it?
3) Is there a better way to solve the problem?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…