I have a log file, which holds the temperature values.
Using this code I can extract only temperature values from it.
Code:
import re
import itertools
infile = "/home/pi/Mysensor/Logs/test.log"
for line in open(infile):
match = re.search('Temp=(\d+)', line)
if match:
test = match.group(1)
print test
My log file:
2017-08-04 -> 16:14:29
Temp=28.0* Humidity=36.0%
Code output:
28
28
25
29
28
25
What I want to do is, just extract only last four results.
I have tried with arrays and list. But could not get a result.
What am I missing here?
How to get this program to get only the final four result?
Thanks in advance.