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()

 

posted @ 2018-02-20 21:39  小学弟-  阅读(218)  评论(0编辑  收藏  举报