【Python函数与模块】(23)文件的读写
摘要:
1. 打开文件/关闭文件 open:f = open('test.txt') close:f.close() 注意:此处需要做异常处理,文件不存在时会有异常 2. with open:利用它打开文件可以不需要关闭 with open('test.txt') as f: do_something(f) 阅读全文
posted @ 2020-04-13 18:00 AC小小常 阅读(246) 评论(0) 推荐(0) 编辑