I am runnning a code and saving entries in a dictionary. HOw can I hold on to this dictionary for 1 min, after which I want to delete its entries, except for those that are 10 sec old?
I am running a certain function in a loop, and I want to save some data generated in that function for analysis in another function later on.
Time calculation: How can I measure one min ?
There's the following, Measure time elapsed in Python? But that I think wont work with the following code structure.
import time
dict={}
def function_run_in_main():
global dict
dict[key]=value
# check time here and delete