首页 > 编程语言 > 详细

python标准库介绍——34 commands 模块详解

时间:2017-11-04 23:07:38      阅读:216      评论:0      收藏:0      [点我收藏+]
==commands 模块==


(只用于 Unix) ``commands`` 模块包含一些用于执行外部命令的函数. 
[Example 3-7 #eg-3-7] 展示了这个模块.

====Example 3-7. 使用 commands 模块====[eg-3-7]

```
File: commands-example-1.py

import commands

stat, output = commands.getstatusoutput("ls -lR")

print "status", "=>", stat
print "output", "=>", len(output), "bytes"

*B*status => 0
output => 171046 bytes*b*
```

  

python标准库介绍——34 commands 模块详解

原文:http://www.cnblogs.com/xuchunlin/p/7784790.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!