擅长:python、mysql、java
<p>当<a href="https://stackoverflow.com/questions/12980148/using-pythons-subprocess-and-popen-in-one-script-to-run-another-python-script-w/12982539#12982539">possible to do with ^{<cd1>} alone in somewhat limited way</a>时,我将使用<a href="https://pexpect.readthedocs.org/en/latest/" rel="nofollow noreferrer">^{<cd2>}</a>进行此类交互,例如:</p>
<pre><code>import pexpect
child = pexpect.spawn('starcluster terminate cluster')
child.expect('Terminate EBS cluster (y/n)?')
child.sendline('y')
</code></pre>