摘要: shutil对压缩包的处理是通过调用zipFile和tarFile两个模块来进行的。 import zipfile # zipfile压缩 z = zipfile.ZipFile('ss.zip', 'w', zipfile.ZIP_STORED) #打包,zipfile.ZIP_STORED是默认参数 # z = zipfile.ZipFile('ss.zip', 'w', zipfile.... 阅读全文
posted @ 2017-12-03 16:25 YangYongming 阅读(15181) 评论(1) 推荐(0) 编辑
摘要: #拷贝文件,可指定长度,fsrc和fdst都是一个文件对象 def copyfileobj(fsrc, fdst, length=16*1024) shutil.copyfileobj(open("ss1", "r"), open("ss2", "w"), length=1024) # 拷贝文件,dst必须可写,存在则覆盖 def copyfile(src, dst, *, follow_sy... 阅读全文
posted @ 2017-12-03 16:24 YangYongming 阅读(470) 评论(0) 推荐(0) 编辑
摘要: 一、ConfigParser简介 ConfigParser 是用来读取配置文件的包。配置文件的格式如下:中括号“[ ]”内包含的为section。section 下面为类似于key-value 的配置内容。 括号“[ ]”内包含的为section。紧接着section 为类似于key-value 的 阅读全文
posted @ 2017-12-03 13:51 YangYongming 阅读(50620) 评论(0) 推荐(6) 编辑