python 捕获shell脚本的输出结果实例

import subprocessoutput =Popen([“mycmd”,”myarg”], stdout=PIPE).communicate()[0]import subprocessp = subprocess.Popen([‘ls’,’-a’], stdout=subprocess.PIPE, stderr=subprocess.PIPE)out, err = p.communicate()print out # work on Unix/Linux onlyimport commandsprint commands.getstatusoutput(‘wc -l file’)[1]以上就是小编为大家带来的python 捕获shell脚本的输出结果实例全部内容了,希望大家多多支持~沿途跟着一条河,你看着它在晨光暮霭中变换着色彩,

python 捕获shell脚本的输出结果实例

相关文章:

你感兴趣的文章:

标签云: