1. 使用os模块。
cur--path = os.path.realpath("__file__”) 获取当前脚本的真实路径
curpath = ospath.dirname ( cur--path)获取当前脚本的文件夹路径
2.apath = os.path.jion(curpath, "脚本.py") # 拼接需要循环的脚本路径
3.使用os.system 执行CMD命令
for i in range(20):
os.system("python %s" % apath) # b脚本执行test_03.py脚本