1.用文件读写1024个对象的日志 10-09 16:12:44.493 6385-6385/com.example.tt.downtest D/Serializable_TAG: write 1024 apples need 230 ms 10-09 16:12:44.546 6385-6385/com.example.tt.downtest D/Serializable_TAG: read 1024 apples need 52 ms 10-09 16:31:23.964 24295-242…
#Filename: file_read_and_write.py #打开文件,cNames读取所有行,储存在列表中,循环对每一行在起始处加上序号1,2,3,4 with open(r'file/companies.txt') as f1: cNames = f1.readlines() for i in range(0,len(cNames)): cNames[i] = str(i+1) + '.' + '' + cNames[i] #将处理过的cNames写入新的文件中 with open(…