title: quit for loop - keyboard interrupt not working
body: <p>I'm trying to program a kill sequence for a for loop, all the samples I see are for while loops, below is my code</p>
  
  <p>I tried using the answer in here <a href="https://stackoverflow.com/questions/13180941/how-to-kill-a-while-loop-with-a-keystroke">How to kill a while loop with a keystroke?</a> using a while and my for inside the while, that allowed me to escape each for loop but it went on infinitely, and on its own as per the below fails too</p>
  
  <pre><code>results = []
  try:
      for i in sites:
          do stuff for each site
  
  except KeyboardInterrupt:
      print 'Keyboard Interrupt: script cancelled'
      import sys
      sys.exit()  
  </code></pre>
  
  <p>tried</p>
  
  <pre><code>try:
      while True:
          for i in sites:
  </code></pre>