I am new to Python and programming in general but I'm willing to learn. I am trying to open a file that just has a time stamp inside of it. I want to take that time in the file and compare it to the now time. I think my issue is I am not converting the incoming string to the right format. Any help would be excellent and help me learn.
-D
`
from datetime import datetime
# get current time
now = datetime.now()
print("Current time: ", now)
filePathLastUpdated = '/Users/dmurray/Desktop/printer folder test/LastUpDated.txt'
lastUpdated = open(filePathLastUpdated, "r")
print("last updated time: ", lastUpdated.read())
if lastUpdated.read() < now:
print("not up to date")
else:
print("up to date")`
the text in the file is "2020-05-20 09:51:28.874028"