2019年4月14日

python中的文件读写操作open和with的用法

摘要: f = open("regist2.txt", 'r', encoding='utf-8') # r read 只能读不能写,文件不存在的时候会报错# w write 文件不存在的话,给创建,不能读,写之前会清空原来的文件内容# a 追加模式 不会清空原来的内容 追加写,但是不能读# r+ 读写模式 阅读全文

posted @ 2019-04-14 13:03 dongxl 阅读(2553) 评论(0) 推荐(0)

导航