摘要: 一、读相关操作1、readline:一次读一行 with open(r'g.txt',mode='rt',encoding='utf-8') as f: # res1=f.readline() # res2=f.readline() # print(res2) while True: line=f. 阅读全文
posted @ 2020-03-16 17:01 学海无涯苦中作乐 阅读(126) 评论(0) 推荐(0)
摘要: 1.x模式(控制文件操作的模式)-》了解(只做了解没啥可说的。) x, 只写模式【不可读;不存在则创建,存在则报错】"""with open('a.txt',mode='x',encoding='utf-8') as f:pass with open('c.txt',mode='x',encodin 阅读全文
posted @ 2020-03-16 16:17 学海无涯苦中作乐 阅读(157) 评论(0) 推荐(0)