Python EOF error when loop
<p>I need to write a python code to print the input like this:</p>

<pre><code>while (True):
    output = raw_input()
    print output
</code></pre>

<p>But when I want to end the loop,I used Ctrl_D,and it says:</p>

<pre><code>  File "./digits.py", line 6, in &lt;module&gt;
    output = raw_input()
  EOFError
</code></pre>

<p>How can I solve it? If possible please give me some simple way because this is the first time I write in python.</p>

<p>The <code>EOFError</code> is an exception that can be caught with <code>try</code>-<code>except</code>. Here we break the loop using the <code>break</code> keyword if an <code>EOFError</code> is thrown:</p>

<pre><code>while True:
    try:
        output = raw_input()
    except EOFError:
        break

    print(output)
</code></pre>

python eoferror