Bash Python os.system 中的脚本

Bash script in Python os.system

我需要在 linux 服务器中使用以下参数执行 bash 脚本 Do_Regr.sh:

./Do_Regr.sh -i Testlist_Regression.in -m 135.24.237.167 -g

如何使用 os.system() 在 Python 脚本中 运行 上述内容?

import subprocess
subprocess.Popen("./Do_Regr.sh -i Testlist_Regression.in -m 135.24.237.167 -g",shell=True)

这应该可以 it.Make 确保您的 python 脚本也在同一目录中或使用 os.chdir 到达那里。