本文实例讲述了python通过shutil实现快速文件复制的方法。分享给大家供大家参考。具体如下:

python通过shutil实现快速文件拷贝,shutil使用起来非常方便,可以通过pip install shutil安装

from shutil import *
from glob import glob
print \'BEFORE:\', glob(\'shutil_copyfile.*\')
copyfile(\'sharejs.com.py\', \'sharejs.com.py.copy\')
print \'AFTER:\', glob(\'shutil_copyfile.*\')

上面这段python代码用于将文件 sharejs.com.py 拷贝到sharejs.com.py.copy

希望本文所述对大家的Python程序设计有所帮助。