title: Can I redirect the stdout into some sort of string buffer?
body: <p>I'm using python's <code>ftplib</code> to write a small FTP client, but some of the functions in the package don't return string output, but print to <code>stdout</code>. I want to redirect <code>stdout</code> to an object which I'll be able to read the output from.</p>
  
  <p>I know <code>stdout</code> can be redirected into any regular file with:</p>
  
  <pre><code>stdout = open("file", "a")
  </code></pre>
  
  <p>But I prefer a method that doesn't uses the local drive.</p>
  
  <p>I'm looking for something like the <code>BufferedReader</code> in Java that can be used to wrap a buffer into a stream.</p>