python中的commands模块

commands模块用于调用shell命令

有3中方法:

commands.getstatus()   返回执行状态

commands.getoutput()   返回执行结果

commands.getstatusoutput()  返回一个元组,执行状态和执行结果

 

其他执行shell命令的方法还有:

1.os.system(cmd)

2.os.popen(cmd)

 

posted @ 2015-01-14 09:24  熠然  阅读(4084)  评论(0编辑  收藏  举报