2019年8月16日

python文件操作

摘要: 文件读操作:1,r模式①f = open('test.txt', mode='r', encoding='utf-8')print(f.read())f.close()②with open('test.txt', 'r', encoding='utf-8')as f: print(f.read())两种方式获得文件句柄,推荐with,运行完之后自动关闭文件2,rb模式with open('te... 阅读全文

posted @ 2019-08-16 13:47 一抹天空 阅读(175) 评论(0) 推荐(0) 编辑

导航