当有多个python文件需要依次运行时
1 依次运行多个python文件
import os
cmd = 'python preprocess.py'
os.system(cmd)
cmd = 'python train.py'
os.system(cmd)
cmd = 'python test.py'
os.system(cmd)
cmd = 'python postprocess.py'
os.system(cmd)
参考文献
(4条消息) 如何按顺序先后执行多个python文件(多个程序)_LJC的博客-优快云博客_python顺序执行多个py文件的方法
https://blog.youkuaiyun.com/weixin_43818631/article/details/119705947
本文介绍如何使用os.system()实现Python文件的有序执行,包括preprocess.py、train.py、test.py和postprocess.py,适合多任务流水线操作。
3830





