It\'s worth leaving here that this is my second day in Python and I\'m not very pro at this language. Any low level suggestion and easy to understand would be much appreciat
You can't reference a variable in a string. A string is just text, it has no knowledge of the namespace, and the interpreter does not resolve that for it.
Since your variable dia
is a string, you can just use that in your call to re.findall
:
if re.findall(dia, line):
pass
or something similar:
if re.findall(r"{0}".format(dia), line):
pass
As for that correctness of what you're doing, if format of the time stamp on the log is the same what you're using, it should be correct.
EDIT: if you are reading strings from the log, you need not (or shouldn't) open them as binary, i.e. the b
flag