shutil

#!/usr/bin/env python
import shutil


f1 = open('本节笔记','r',encoding='utf-8')
f2 = open('笔记2','w')
shutil.copyfileobj(f1,f2)
shutil.copyfile('本节笔记','笔记3')
#shutil.copytree('test','test1')#拷贝目录
#shutil.rmtree('test')#删除目录
#shutil.move()#移动文件
#shutil.make_archive()#压缩文件
#shutil.make_archive('shutil_ar','zip',r'F:\python\s14')
import zipfile
# 压缩
z = zipfile.ZipFile('day5.zip','w')
z.write('shutil1.py')
z.write('笔记2')
z.close()
# 解压
z = zipfile.ZipFile('laxi.zip', 'r')
z.extractall()
z.close()


#相关链接:http://www.cnblogs.com/wupeiqi/articles/4963027.html
posted @ 2018-11-11 16:08  rongye  阅读(190)  评论(0编辑  收藏  举报