I borrowed some code from this site to increment a number when a python script is run. This works great. What I am trying to do is if the script is run numerous times in one day the variable should not change. When the script is run on a different day the number increments one time for that day. This is the code I borrowed.
def new_num(filename="varstore.dat"):
with open(filename, "a+") as f:
val = int(f.read() or 0) + 1
f.seek(0)
f.truncate()
f.write(str(val))
return val