如有一个可执行命令cmd,希望在python中执行,有几种方法
一、os.system(cmd)
这种方式之前有日志,突然没有了
二、os.popen(cmd)
下面这么写可以有日志
f = os.popen(cmd) print(f.read())
三、subprocess.Popen(cmd)