shutil模块的作用
主要用于文件或目录的复制或归档的操作
1、复制文件,如果没有权限的话,会抛出IOError异常
import shutil import glob print('之前的目录',glob.glob('shutil_copyfile.*')) shutil.copyfile('shutil_copyfile.py','shutil_copyfile.py.copy') print('之后的目录',glob.glob('shutil_copyfile.*'))
shutil模块的作用
主要用于文件或目录的复制或归档的操作
1、复制文件,如果没有权限的话,会抛出IOError异常
import shutil import glob print('之前的目录',glob.glob('shutil_copyfile.*')) shutil.copyfile('shutil_copyfile.py','shutil_copyfile.py.copy') print('之后的目录',glob.glob('shutil_copyfile.*'))
相关文章: