python调用系统命令的方法

1、os模块

(1)system()方法

 这个方法是直接调用标准C的system() 函数,在一个子终端运行系统命令

 

(2)poen()方法

这个方法执行命令后通过一个管道文件将结果返回

 

3、subprocess

(1)check_output()方法

 

(2)call()方法

 

(3)Popen()方法

 

4、commands模块

返回一个元组

(2)getoutput()方法

 

(2)getstatusoutput()方法

 

也就了解这莫多,希望大佬朋友多多指点批评

原文地址:https://www.cnblogs.com/ydy11/p/8093878.html