我从本周开始学习Python(并一起编码),但我坚持要做的简单任务。
我正在寻找的功能是这样:
我现在编写的代码:
import os
import subprocess
autocadPath = r'C:\Program Files\Autodesk\AutoCAD 2019\acad.exe'
for file in os.listdir("D:\openFiles"):
if file.endswith(".dwg"):
print(os.path.join("D:\openFiles", file))
subprocess.Popen("%s %s" % (autocadPath, os.path.join("D:\openFiles", file)))
当我运行此命令时会发生什么:
(我在de目录中只有2个.dwg文件。)
我希望有人可以帮助我解决这个问题。