import os path="E:\\python" #批量的py文件路径 for root,dirs,files in os.walk(path): #进入文件夹目录 for f in files: #文件夹下的文件 if os.path.splitext(f)[1]=='.py': #只运行py文件 os.chdir(root) os.system('python {}'.format(f)) #终端运行 python main.py
sh for循环 for File in 1 2 3 4 5 do echo $File done sh for多重循环 for image_size_input in 160 140 120 100 80 do echo $image_size_input for depth_multiplier_input in 1 0.75 0.50 0.25 do echo $depth_multiplier_input done done sh python输入参数 for image_size_in