python shutil模块学习

来源:互联网 发布:葩奇软件 编辑:程序博客网 时间:2024/06/04 18:49


The shutil module offers a number of high-level operations on files and collections of files. In particular, functions are provided which support file copying and removal.

copy函数和copyfile函数的区别是:

>>> help(shutil.copy)
Help on function copy in module shutil:

copy(src, dst)
    Copy data and mode bits ("cp src dst").
   
    The destination may be a directory.

>>> help(shutil.copyfile)
Help on function copyfile in module shutil:

copyfile(src, dst)
    Copy data from src to dst

shutil.move(src,dst)

If the destination is on the current filesystem, then os.rename() is used. Otherwise,src is copied (using shutil.copy2()) todst and then removed

0 0
原创粉丝点击