Python. IOError: [Errno 13] Permission denied: when i'm copying file

后端 未结 9 1327
轮回少年
轮回少年 2021-01-03 19:44

I have two folders: In, Out - it is not system folder on disk D: - Windows 7. Out contain \"myfile.txt\" I run the following command in python:

>>>          


        
9条回答
  •  被撕碎了的回忆
    2021-01-03 20:04

    Use shutil.copy2 instead of shutil.copyfile

    import shutil 
    shutil.copy2('/src/dir/file.ext','/dst/dir/newname.ext') # file copy to another file
    shutil.copy2('/src/file.ext', '/dst/dir') # file copy to diff directory
    

提交回复
热议问题