title: How do I exit python program with control d?
body: <p>I have a python program that uses a while loop to check for a user input. I want it to keep running while a user enters an input, but quit when the user enters ctrl d. Currently, I get EOFError when typing ctrl d. I am new to python so any advice on how to fix this would be really helpful.</p>
  <p>Here is a very simple example of my code:</p>
  <pre><code>while True:
    userInput = input()
    ...
  exit()
  </code></pre>