Possible Duplicates:
How to get output from subprocess.Popen()
Retrieving the output of subprocess.call()
这是我的问题。我有一个名为device_console的可执行文件。device_控制台为设备提供命令行接口。在设备控制台中,可以运行四个命令:status、list、clear和exit。每个命令产生一个输出。例如:
[asdfgf@localhost ~]$ device_console
device_console> list
File A
File B
device_console> status
Status: OK
device_console> clear
All files cleared
device_console> list
device_console> exit
[asdfgf@localhost ~]$
作为测试的一部分,我希望获得每个命令的输出。我想用Python。我正在查看Python的子进程,但不知怎么的,我无法将它们组合在一起。你能帮忙吗?在
使用^{} module 。示例:
听起来你想要更像“期待”的东西。在
退房Pexpect
相关问题 更多 >
编程相关推荐