0
我有一个文件夹序列(planx 1,planx 2,.......,planx 35)每个文件夹都包含一个exe文件triton.exe
,我写了下面的代码,但是它给出了我一个语法错误,显然我写的格式特别是'+ str(i)'是错误的。在一个文件夹序列中运行EXE文件
我试图通过在+ str(i)之前加上“”来解决该问题,但它没有空格读取文件夹名称(planx1),并且没有这样的文件夹。
我能做些什么才能使它工作?
import sys, string, os
for i in range(1, 35):
os.chdir('E:\\project\\x\\CR 0\\planx'+str(i))
os.system('"E:\\project\\x\\CR 0\\planx'+str(i)'\\triton.exe"')
print('done')
它的工作,谢谢 –