擅长:python、mysql、java
<p>尝试将Popen构造函数与stdout arg一起使用:</p>
<pre><code>subprocess.Popen(['"sudo ./" + config.sh'], stdout=subprocess.PIPE)
</code></pre>
<p>另请参见:
<a href="https://stackoverflow.com/questions/30135956/get-return-value-from-shell-command-in-python">Get return value from shell command in python</a></p>
<p>另外,这里还有Python文档中关于Popen的更多信息。
<a href="https://docs.python.org/2/library/subprocess.html#popen-constructor" rel="nofollow noreferrer">https://docs.python.org/2/library/subprocess.html#popen-constructor</a></p>