【python】高效读写文件

第一种:python f = open('users','r+',encoding='utf-8') #文件对象,或者文件句柄 l=['abc123\n','bcd123\n'] f.writelines(l)#会循环list里面的每一个元素写进去 #结果 abc123 bcd123 第二种:要求文件里不能有空行code f = open('users','r+',encoding='utf-8
相关文章
相关标签/搜索