title: python - printing something in a for loop every n seconds
body: <p>I have a for loop that iterates over a number and performs some simple calculations.  I am trying to figure out how to print out ( or log to file) the current value of 'val' every .5 to 1 second with out having to pause or sleep during the loop.  Here is a super simple example</p>
  
  <pre><code>val_list = []
  
  for i in xrange(iterations):
      val = (i*(1/2)) * pi
      val2 = np.linalg.pinv(val)
      # print or write to log val2 after every half second (or 1 second)
      val_list.append(val2)
  </code></pre>