0

Please can someone help me out here

what is EOF error and how can I correct it?

18th Jul 2017, 9:08 AM
Tochukwu Udeozor
Tochukwu Udeozor - avatar
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
18th Jul 2017, 9:13 AM
jay
jay - avatar
+ 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
18th Jul 2017, 9:21 AM
Apoorva Shenoy Nayak
Apoorva Shenoy Nayak - avatar