I have a series of entries in a text file like this:
20150217_00:47:32 - AAAAAA
20150217_00:47:32 - BBBBBB
20150217_00:47:32 - CCCCCC
I want to make a function that will periodically read each line in the file and do something depending on whether the entry is less than 2 days old, more than 2 days old, or more than 7 days old.
I'm not sure how to get the code to understand the sttime timestamp in the file though. My code (so far) is as follows:
with open('entries.txt', 'r+') as entries:
for line in entries:
lineitem = line.strip()
print lineitem[:17]
That retrieves the timestamps ok, but how to read them and interpret them as times I have no idea :/
(This will end up in an if loop eventually that does the function described above, but first I just need to know how to read those times...)