parse_ports_log.py: python 3 compatibilty

This commit is contained in:
Ad Schellevis 2020-02-05 19:08:46 +01:00
parent 9f2c1b2c67
commit fcbc99b41b
1 changed files with 3 additions and 2 deletions

View File

@ -1,12 +1,13 @@
#!/usr/bin/env python2.7
#!/usr/bin/env python3.7
import collections
import argparse
from datetime import datetime
def log_reader(filename):
with open(filename) as f_in:
with open(filename ,'rb') as f_in:
for line in f_in:
line = line.decode()
if len(line) >= 22 and line[0] == '[' and line[15] == ']' and line[1:15].isdigit() \
and line[17:21] == '===>' and line.find(' for ') > -1:
if line.strip().endswith('for building'):