python 捕获shell脚本的输出结果实例
importsubprocess
output=Popen(["mycmd","myarg"],stdout=PIPE).communicate()[0]
importsubprocess
p=subprocess.Popen(['ls','-a'],stdout=subprocess.PIPE,stderr=subprocess.PIPE)
out,err=p.communicate()
printout
#workonUnix/Linuxonly
importcommands
printcommands.getstatusoutput('wc-lfile')[1]
以上就是小编为大家带来的python捕获shell脚本的输出结果实例全部内容了,希望大家多多支持毛票票~