我正在尝试将子目录中的文件移动到临时文件夹中。这是我的代码:
with tempfile.TemporaryDirectory() as tempDirectory:
for root, dirs, files in os.walk(fileDestination, topdown=True):
for file in files:
shutil.move(file, tempDirectory)
当我查看调试器时,我可以看到文件变量的值,其中包含我要移动的文件。但是什么都没有移动,然后我收到错误 FileNotFoundError ,它引用了我要移动的文件。当我查看我的文件资源管理器时,我可以看到文件没有移动。