parse_ports_log.py: python 3 compatibilty
This commit is contained in:
parent
9f2c1b2c67
commit
fcbc99b41b
|
@ -1,12 +1,13 @@
|
||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/env python3.7
|
||||||
import collections
|
import collections
|
||||||
import argparse
|
import argparse
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
def log_reader(filename):
|
def log_reader(filename):
|
||||||
with open(filename) as f_in:
|
with open(filename ,'rb') as f_in:
|
||||||
for line in 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() \
|
if len(line) >= 22 and line[0] == '[' and line[15] == ']' and line[1:15].isdigit() \
|
||||||
and line[17:21] == '===>' and line.find(' for ') > -1:
|
and line[17:21] == '===>' and line.find(' for ') > -1:
|
||||||
if line.strip().endswith('for building'):
|
if line.strip().endswith('for building'):
|
||||||
|
|
Loading…
Reference in New Issue