Jun-24-2021, 09:32 AM
(This post was last modified: Jun-24-2021, 09:34 AM by Gribouillis.)
There are many things to do to improve the code. First steps:
- remove the line with
.readlines()
and don't close the logfile.
- use
for line, count in enumerate(FullLogFile, 1):
directly and don't increment count.
- before the second pass, use
FullLogFile.seek(0)
to go back to the beginning of the file, then again usefor line in FullLogFile:
- Acually, you could do everything in a single pass.