title: exit while loop with user prompt in python
body: <p>I've been browsing a long time searching an answer to this.</p>
  
  <p>I'm using Python 2.7 in Unix.</p>
  
  <p>I have a continuous while loop and I need an option where user could interrupt it, do something and after that the loop would continue.</p>
  
  <p>Like:</p>
  
  <pre><code>while 2 &gt; 1:
       for items in hello:
           if "world" in items:
               print "hello"
           else:
               print "world"
  
        time.sleep(5)
        here user could interrupt the loop with pressing "u" etc. and modify elements inside he loop. 
  </code></pre>
  
  <p>I started testing out with raw_input, but since it prompts me out every cycle, it's something that I don't need.</p>
  
  <p>I tried methods mentioned here:</p>
  
  <p><a href="https://stackoverflow.com/questions/1335507/keyboard-input-with-timeout-in-python">Keyboard input with timeout in Python</a></p>
  
  <p>couple of times, but none of those seem to work how I wish.</p>