Python文件将日志文件中每天的日志拿出来
file_log.txt文件内容如下:
with open('file_log.txt', 'r', encoding='utf-8') as f: for i in f: s = i.split() #print(s) data = s[0] with open(data+'.log', 'a', encoding='utf-8') as ff: ff.write(i) ff.flush()
file_log.txt文件内容如下:
with open('file_log.txt', 'r', encoding='utf-8') as f: for i in f: s = i.split() #print(s) data = s[0] with open(data+'.log', 'a', encoding='utf-8') as ff: ff.write(i) ff.flush()