0
Please can someone help me out here
what is EOF error and how can I correct it?
2 Answers
+ 6
we might need more to go on than that, can you show the code that produces the error
EOF = end of file
+ 3
The input raises an EOFError when it hits an end-of-file condition. Essentially, input lets you know we are done here there is nothing more to read. You should await for this exception and when you get it just return from your function or terminate the program.
You can handle it as below-
def process_input():
p = input()
while True:
try:
line = input()
except EOFError:
return
a = line.find(p)
if a != -1:
print(line)
if line==' ':
return