title: Prevent reading of previous / prior user keyboard input from sys.stdin, that works with Click
body: <p>Say you want to ask the user something from the terminal at the end of your program.
  However, during the program run, the user pressed the enter key.</p>
  <pre><code>import sys
  import time
  print(&quot;Hit enter now to see this 'problem'&quot;)
  time.sleep(1)
  # Hit enter now while the program sleeps!
  a=input(&quot;Do you want to delete something that is really bad to delete? [Y|n]&quot;)
  if a.lower()!=&quot;n&quot;:
      print(&quot;\nNO! YOU DELETED IT!&quot;)
  </code></pre>
  <p>Of course, it's stupid to delete stuff with default response, and I don't do that. However, It's annoying that I, the user, sometimes hit enter and the default is what goes.</p>
  <p>I'm <em>actually</em> using <a href="https://click.palletsprojects.com/en/7.x/" rel="nofollow noreferrer">click</a> to read the input. So I'd want a preventative command before click executes;</p>
  <pre><code>import sys
  import click
  import time
  print(&quot;Hit enter now to see this 'problem'&quot;)
  time.sleep(1)
  # Hit enter now while the program sleeps!
  # Clear stdin here somehow.
  sys.stdin.flush() # &lt;- doesn't work though 
  a=input(&quot;Do you want to delete something that is really bad to delete? [Y|n]&quot;)
  if a.lower()!=&quot;n&quot;:
      print(&quot;\nNO! YOU DELETED IT!&quot;)
  </code></pre>
  <p>I'm on Linux (Ubuntu 16.04 and Mac OS).</p>
  <p>Any ideas?</p>