title: Reading from sys.stdin, ending user input with RETURN
body: <p>I am working on a script with user input in Py 3.6.</p>
  
  <p>In the script, the user is asked to enter a text section - potentially containing new lines - into the shell. The entered text will then be saved to a Python variable for further processing. </p>
  
  <p>Since the user input may contain newlines, I think I cannot use <code>input()</code> but am using <a href="https://docs.python.org/3.6/library/sys.html#sys.stdin" rel="nofollow noreferrer"><code>sys.stdin.read()</code></a> (as suggested <a href="https://stackoverflow.com/questions/2542171/python-3-receive-user-input-including-newline-characters">here</a>). </p>
  
  <h3>Problem</h3>
  
  <p>Reading in the input works fine, but to <strong>end</strong> the user input, the user has to hit Return and then use the key combination <code>CTRL + d</code> (see <a href="https://stackoverflow.com/questions/5549141/how-to-finish-sys-stdin-readlines-input">here</a>). (See <em>Current Procedure</em> below)</p>
  
  <h3>Question</h3>
  
  <ul>
  <li>I would prefer that the user can just end their input to <code>sys.stdin.read</code> by hitting the Return key (cf <em>Expected Procedure</em> below) </li>
  </ul>
  
  <p><strong>EDIT: Any other simplification to the current process with <code>CTRL + d</code> is appreciated as well.</strong></p>
  
  <ul>
  <li><p>Is this doable?</p></li>
  <li><p>There are some hacks <a href="https://stackoverflow.com/questions/15692149/taking-multiline-input-with-sys-stdin">here</a> but I thought maybe there is a better way</p></li>
  </ul>
  
  <h3>Current code</h3>
  
  <pre><code>    # display text on screen
      print("Review this text\n" + text)
      # user will copy and paste relevant items from text displayed into Terminal
      user_input =  sys.stdin.read() 
      print ("hit ctrl + d to continue")
      # process `user_input`
  </code></pre>
  
  <h3>Current procedure</h3>
  
  <p>With the current code reproduced below, the user has to </p>
  
  <p>1) paste the text
  2) hit <code>RETURN</code> to end input
  3) hit <code>Ctrl+d</code> to move to next file</p>
  
  <h3>Expected procedure</h3>
  
  <p>I would like to reduce this to: </p>
  
  <p>1) paste the text
  2) hit <code>RETURN</code> to end input and move to next file</p>
  
  <p>Running Python 3.5.6 on MacOSX, using Terminal for text input. 
  Any help is much appreciated!</p>