使用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 - 触摸屏有时会吸。 –