May-07-2020, 10:59 PM
I was running tests with it and I don't really see the problem. The first time you run it, you can grab the latest time, as that will be the first login. I also don't really know how you plan on running this program. You may need to use a txt file in which to save the list if the program is not always running, other than that I only did one small change to your code. I changed line 11 to the following.
previouslogindate = datetime.datetime.strptime(previousloginlist[len(previousloginlist)-1], Format)Then if you did plan on saving the code would look something like that (I used l for short)
l = [] l = loadData() if not l: l = [datetime.datetime.now()] #code saveData(l)If you have any other problems I'm happy to help