-
Copy the contents (no metadata) of the file named src to a file nameddst and return dst. src and dst are path names given as strings.dst must be the complete target file name; look at
shutil.copy()
for a copy that accepts a target directory path. If src and dstspecify the same file,SameFileError
is raised.
shutil.
copyfile
(
src,
dst,
*,
follow_symlinks=True
)
犯了一个想当然的错误,本以为 src是已存在的文件,而copyfile的功能是将 src 整个文件复制并重命名为 dst ,emmm事实上 src 与 dst 两个都是已存在的文件,copyfile的功能是将src中的数据拷贝到dst文件中。
PS:我最开始就是进的官方文档找答案,我按照自己的翻译理解了他的用法……然鹅…… 原来我的英语水平这么垃圾,啊,暴击 还是抱谷歌翻译大腿吧……