How to implement an automatically expiring variable in python? For example, Let the program running For one hour. I want implement an array of 6 variables, each variable in
import sched
import time
import threading
a = [1, 2, 3, 4, 5, 6]
scheduler = sched.scheduler(time.time, time.sleep)
def delete(_list):
del _list[0]
for i in range(len(a)):
scheduler.enter(60*10*i, 1, delete, (a,))
t = threading.Thread(target=scheduler.run)
t.start()