📜  如何在 python 代码示例中捕获 cmd 输出

📅  最后修改于: 2022-03-11 14:46:33.235000             🧑  作者: Mango

代码示例4
from subprocess import Popen, PIPE
path = "echo"
pipe = Popen(path, stdout=PIPE)
text, err = pipe.communicate()
if(pipe.returncode==0)
print( text, err)