import os
path="E:\\python" #Batch py file path
for root,dirs,files in os.walk(path): #Enter the folder directory
for f in files: #Files under the folder
if os.path.splitext(f)[1]=='.py': #Run only py files
os.chdir(root)
os.system('python {}'.format(f)) #Terminal run python main.py
Recommended Posts