Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否可以用python来解决运行两个可执行文件并且它们可以相互通信(stdin/stdout)的问题?_Python_Redirect_Stdout_Stdin - Fatal编程技术网

是否可以用python来解决运行两个可执行文件并且它们可以相互通信(stdin/stdout)的问题?

是否可以用python来解决运行两个可执行文件并且它们可以相互通信(stdin/stdout)的问题?,python,redirect,stdout,stdin,Python,Redirect,Stdout,Stdin,我有两个可执行文件,例如A.exe、B.exe。 使用python子进程popen,两个可执行文件是否可以通过stdin/stdout相互通信: A = Popen("A.exe",...,stdin=B.stdout, stdout=PIPE) B = Popen("B.exe",...,stdin=A.stdout, stdout=PIPE) ? (其中A.exe包含print/scanf对,B.exe包含scanf/printfs。)尝试Popen.communicate它使用参数输入和

我有两个可执行文件,例如A.exe、B.exe。 使用python子进程popen,两个可执行文件是否可以通过stdin/stdout相互通信:

A = Popen("A.exe",...,stdin=B.stdout, stdout=PIPE)
B = Popen("B.exe",...,stdin=A.stdout, stdout=PIPE) ?

(其中A.exe包含print/scanf对,B.exe包含scanf/printfs。)

尝试
Popen.communicate
它使用参数
输入
和文本发送到子进程,并返回元组
(stdout\u数据,stderr\u数据)


不知道你在问什么,尽管
pexpect
和两者都运行并执行你希望从一个到另一个的任何操作?似乎是重复的
(output, error) = A.communicate(input="send to a")