python 在python脚本内运行linux命令
在python脚本内运行linux命令
python">#/usr/bin/env python import subprocess class RunCmd(object): def cmd_run(self, cmd): self.cmd = cmd subprocess.call(self.cmd, shell=True) #Sample usage a = RunCmd() a.cmd_run('ls -l')
在python脚本内运行linux命令
python">#/usr/bin/env python import subprocess class RunCmd(object): def cmd_run(self, cmd): self.cmd = cmd subprocess.call(self.cmd, shell=True) #Sample usage a = RunCmd() a.cmd_run('ls -l')