title: Redirect print to string list?
body: <p>I know how to redirect print to a file.</p>
  
  <pre><code>import sys
  
  orig_stdout = sys.stdout
  f = file('out.txt', 'w')
  sys.stdout = f
  
  for i in range(2):
      print ('i = ', i)
  
  sys.stdout = orig_stdout
  f.close()
  </code></pre>
  
  <p>I need to do the same but w/out a file: keep print output in a string list. How to do it in Py3k?</p>
  
  <p>Edit: I can have 3rd party prints in a middle part, not my own prints, so code must be universal for usual "print()".</p>