我在写一个调用命令行(例如python本身)的Python代码,该命令将打开它自己的shell。 Python如何控制这个shell?Python - 打开一个打开另一个shell的命令
import subprocess
subprocess.call(['./testprg'])
# testprg will open its own shell
# so the code below will not work
subprocess.call(['i 2'])
testprg是打开shell提示符的另一个程序。输入“I 2”将触发与值2
或['winpexpect'(https://bitbucket.org/geertj/winpexpect/wiki/Home)在Windows – jfs