Python中的commands模块

commands有三个主要函数,可以使用help(commands)查看,是python的内置模块

1.commands.getstatusoutput(cmd)返回一个元组tuple(status, output),status为int类型,result为string类型。

status代表的shell命令的返回状态,如果成功的话是0;output是shell的返回的结果

2.commands.getstatus(file)

3.commands.getoutput(cmd) 判断Shell命令的输出内容 (返回结果为string类型)