python commands模块

1、commands.getstatusoutput('shell command')  #执行shell命令,返回执行状态和执行结果

可以根据返回状态判断命令是否执行成功,0为真,非0为假

你可能感兴趣的:(python)