python 捕获shell脚本的输出结果实例
程序员文章站
2024-02-13 11:04:10
import subprocess
output =Popen(["mycmd","myarg"], stdout=PIPE).communicate()[0]
i...
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脚本的输出结果实例全部内容了,希望大家多多支持~
上一篇: Android 同时setTag两次保存多种值的示例代码
下一篇: Android 自绘控件