最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
python捕获shell脚本的输出结果实例
时间:2017-01-07 编辑:简简单单 来源:一聚教程网
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]
相关文章
- mybatis基本实例详解 08-03
- C语言 makefile学习及实现实例 08-01
- ps玻璃杯子制作实例 07-26
- Python编程之event对象的用法实例分析 07-20
- 详解Java CountDownLatch完成异步回调实例 07-18
- 数码单反怎么摄影 数码单反实例教程 07-13