I am logging in DataLogging.csv
Temperature and Humidity:
2016-04-07 09:36 16.0 48.7
2016-04-07 09:37 16.0 48.7
2016-04-07 09:38 16.0 48.7
2016-04-07 09:39 16.1 48.8
2016-04-07 09:40 16.1 48.7
row[0]
gets me the Date, row[1]
the Temp and row[2]
Humidity
What is the fastest way to get the Temperature and Humidity Values from the last row of the file(so those that have been logged last)? In this case the 09:40
values
@Edit: The Logger runs on a Raspberry Pi 2
I found this method: (Stackoverflow Link)
from collections import deque
import csv
def get_last_row(csv_filename):
with open(csv_filename, 'rb') as f:
return deque(csv.reader(f), 1)[0]
lastline = ', '.join(get_last_row('DataLogger.csv'))
values = lastline.split("\t")
print ((values[1]))
now I get the Temperature Value from the Last line ....