python 复制替换文件
The python language provides a built-in module "shutil", which offers numerous high-level operations on files and collections of files. In particular, functions are provided to support the file copying and removal.
python语言提供了一个内置的模块“ shutil” ,该模块对文件和文件集合提供了许多高级操作。 特别是,提供了支持文件复制和删除的功能。
拷贝文件 (Copy file)
shutil.copyfile(src, dst, *, follow_symlinks=True)
Copies the contents of file from source(src) to destination(dst). src and dst are the path names as a string. dst must be the complete target file name.
将文件内容从源( src )复制到目标( dst )。 src和dst是字符串形式的路径名。 dst必须是完整的目标文件名。
Reminders,
提醒事项
If src and dst are the same locations, SameFileError is raised.
如果src和dst位于相同的位置, 则会引发