使用shutil.copyfile()我試着讓我的第一個Python程序,將所有的文件從一個文件夾複製並粘貼到另一個:IO錯誤在Windows
import shutil
shutil.copyfile("C:\Users\USER\Desktop\MoveFrom\Test.txt",
"C:\Users\USER\Desktop\MoveTo")
,但我不斷收到錯誤消息,爲什麼想不通:
Traceback (most recent call last):
File "C:\Users\USER\Desktop\Python\movefiles.py", line 2, in <module>
shutil.copyfile("C:\Users\USER\Desktop\MoveFrom\Test.txt", "C:\Users\USER\Desktop\MoveTo")
File "C:\PYTHON27\lib\shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: 'C:\\Users\\USER\\Desktop\\MoveTo'
謝謝@martineau - 觸摸屏有時會吸。 –