为目录中的所有文件传递exe到Python

2024-06-26 02:41:27 发布

您现在位置:Python中文网/ 问答频道 /正文

当我对单个文件执行命令时,它就工作了。但是,当我想在循环中使用它时,它不起作用。有什么问题吗? 从子流程导入调用 导入操作系统,系统

rootdir = r'C:\\Users\\X\\Desktop\\hump'

for root, dirs, files in os.walk(rootdir):
    for file in files:
        if file.endswith(".ply"):            
            nf = file.replace('.ply', '.txt')
            os.system("C:\\Users\\X\\Desktop\\fftw-3.3.5 dll64\\ShapeDescriptor.exe --in file --out nf")

Tags: 文件inforos系统files流程执行命令