摘要: [toc] x模式 ​ X:只写模式,不可读;不存在则创建,存在则报错 b模式:binary模式 b模式和t模式的差别 t: ​ 1、读写都是以字符串(unicode)为单位 ​ 2、只能针对文本文件 ​ 3、必须指定字符编码,即必须指定encoding参数 b:binary模式 ​ 1、读写都是以 阅读全文
posted @ 2020-03-16 20:44 灑 阅读(594) 评论(0) 推荐(0) 编辑
摘要: 1、通用文件copy工具实现 old_file=input('要复制的文件路径>>: ').strip() new_file=input('复制到文件路径>>: ').strip() with open(r'{}'.format(old_file),mode='rb') as f1,\ open(r 阅读全文
posted @ 2020-03-16 20:39 灑 阅读(193) 评论(0) 推荐(0) 编辑