title: How to get user input during a while loop without blocking
body: <p>I'm trying to write a while loop that constantly updates the screen by using os.system("clear") and then printing out a different text message every few seconds. How do I get user input during the loop? raw_input() just pauses and waits, which is not the functionality I want.</p>
  
  <pre><code>import os
  import time
  
  string = "the fox jumped over the lazy dog"
  words = string.split(" ")
  i = 0 
  
  while 1:
      os.system("clear")
      print words[i]
      time.sleep(1)
      i += 1
      i = i%len(words)
  </code></pre>
  
  <p>I would like to be able to press 'q' or 'p' in the middle to quit and pause respectively.</p>