这是我的python脚本
import subprocess
result = subprocess.Popen('./test.sh', stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
output, err = result.communicate()
print output
这是我的shell脚本
testFn(){
exit 1;
}
testFn "hello"
在执行python脚本之后,我需要打印1,但是我什么也看不到。我做错什么了?你知道吗
output
来自标准输出。你想要返回码。你知道吗通过以下方式获得:
相关问题 更多 >
编程相关推荐