擅长:python、mysql、java
<p>不能像使用<code>shell=True</code>那样在命令中直接使用管道,但它很容易适应:</p>
<pre><code>with open(file_name, 'ab') as outf:
proc = subprocess.Popen(['candump', '-tA', 'can0', 'can1'], stdout=outf)
</code></pre>
<p>它在Python级别为binary append打开文件,并将其作为子进程的<code>stdout</code>传递。在</p>