eoferror eof when reading a line – What is EOFError? – EOFError is raised when one of the built-in Python functions input() as well as raw_input() hits an end-of-file condition (EOF) without reading any data.
As per the Python documentation Python input raises an EOFError when it hits an end-of-file main condition.
n = int(input())
print(n * 10)
This Python exception can be handled as:
try:
n = int(input())
print(n * 10)
except EOFError as e:
print(e)
try:
input("Please enter something")
except:
print("EOF")
https://docs.python.org/3.5/library/exceptions.html
def process_input():
p = input()
while True:
try:
dt = input()
except EOFError:
return
res = dt.find(p)
if res != -1:
print(dt)
if dt=='':
return
I hope you get an idea about eoferror eof when reading a line.