Python: How to Redirect Output with Subprocess?
<p>What I do in the command line:</p>

<pre><code>cat file1 file2 file3 &gt; myfile
</code></pre>

<p>What I want to do with python:</p>

<pre><code>import subprocess, shlex
my_cmd = 'cat file1 file2 file3 &gt; myfile'
args = shlex.split(my_cmd)
subprocess.call(args) # spits the output in the window i call my python program
</code></pre>
