import subprocess
output =popen(["mycmd","myarg"], stdout=pipe).communicate()[0]
import subprocess
p = subprocess.Popen(['ls','-a'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
print out
# work on Unix/Linux only
import commands
print commands.getstatusoutput('wc -l file')[1]
立即学习“Python免费学习笔记(深入)”;
以上就是小编为大家带来的python 捕获shell脚本的输出结果实例全部内容了,希望大家多多支持PHP中文网~
更多python 捕获shell脚本的输出结果实例相关文章请关注PHP中文网!
python怎么学习?python怎么入门?python在哪学?python怎么学才快?不用担心,这里为大家提供了python速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号