擅长:python、mysql、java
<p>您可以将<code>input</code>赋予<a href="https://docs.python.org/2/library/subprocess.html#subprocess.Popen.communicate" rel="nofollow">^{<cd2>}</a>函数。在</p>
<p>像</p>
<pre><code>p1 = Popen(["mycmd"], stdin=PIPE, stdout=PIPE)
output = p1.communicate(input="my input")[0]
</code></pre>