title: Python: How to get stdout after running os.system?
body: <p>I want to get the <code>stdout</code> in a variable after running the <code>os.system</code> call.</p>
  
  <p>Lets take this line as an example: </p>
  
  <pre><code>batcmd="dir"
  result = os.system(batcmd)
  </code></pre>
  
  <p><code>result</code> will contain the error code (<code>stderr</code> <code>0</code> under Windows or <code>1</code> under some linux for the above example).</p>
  
  <p>How can I get the <code>stdout</code> for the above command without using redirection in the executed command?      </p>