python 捕获shell脚本的输出结果实例
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 捕获shell脚本的输出结果实例全部内容了,希望大家多多支持脚本之家~
相关文章
python网络编程:socketserver的基本使用方法实例分析
这篇文章主要介绍了python网络编程:socketserver的基本使用方法,结合实例形式分析了python网络编程中socketserver的基本功能、使用方法及操作注意事项,需要的朋友可以参考下2020-04-04
最新评论