摘要: '''#1、通用文件copy工具实现old_file = input('请输入原文件地址:').strip()new_file = input('请输入目标地址:').strip()with open(r'%s' %old_file,'rb') as rf, open(r'%s' %new_file 阅读全文
posted @ 2020-07-16 19:37 画堂晨起 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 操作文件的方法 文件操作模式: # r只读模式: 在文件不存在时则报错,文件存在文件内指针直接跳到文件开头 with open('a.txt',mode='r',encoding='utf-8') as f: res=f.read() # 会将文件的内容由硬盘全部读入内存,赋值给res # w只写模 阅读全文
posted @ 2020-07-16 18:36 画堂晨起 阅读(249) 评论(0) 推荐(0) 编辑