Python执行shell命令方法
1、系统和python版本CentOS Linux release 7.5.1804 (Core)[root@node02-97 ~]# python -VPython 2.7.5

3、os.popen('pwd','r')

5、subprocess.call(['ls','-l'],shell=True)

7、os.spawnv(os.P_NOWAIT, 'ls', '-l')

1、系统和python版本CentOS Linux release 7.5.1804 (Core)[root@node02-97 ~]# python -VPython 2.7.5
3、os.popen('pwd','r')
5、subprocess.call(['ls','-l'],shell=True)
7、os.spawnv(os.P_NOWAIT, 'ls', '-l')