python run time error while raw input multiple line string

input, python

Solution

You may get a EOFError if you terminate the program with an EOF (Ctrl-d in Linux, Ctrl-z in Windows). You can catch the error with:

while True:
    try:
        line = (raw_input().strip())
    except EOFError:
        break
    if not line: break

Problem

I want to read multiple line input. format of input is first line contains int as no. of lines followed by string lines. i tried with ``` while True: line = (raw_input().strip()) if not line: break elif line.isdigit(): continue else: print line ``` it prints the string lines but shows run time error message ``` Traceback (most recent call last): File "prog.py", line 2, in <module> line = (raw_input().strip()) EOFError: EOF when reading a line ``` Is it the right way to read input? Why run time error? I am new to python Please help me

Original source