Answers for "how to make python do something every x seconds"

0

how to make python do something every x seconds

import sched, time
s = sched.scheduler(time.time, time.sleep)
def do_something(sc): 
    print("Doing stuff...")
    # do your stuff
    s.enter(60, 1, do_something, (sc,))

s.enter(60, 1, do_something, (s,))
s.run()
Posted by: Guest on April-16-2021

Code answers related to "how to make python do something every x seconds"

Python Answers by Framework

Browse Popular Code Answers by Language