has a method in python likw setinterval function in javascript ?
thanks
has a method in python likw setinterval function in javascript ?
thanks
The sched
module provides these abilities for general Python code. However, as its documentation suggests, if your code is multithreaded it might make more sense to use the threading.Timer
class instead.
Things work differently in Python: you need to either sleep()
(if you want to block the current thread) or start a new thread. See http://docs.python.org/library/threading.html
From Python Documentation:
from threading import Timer
def hello():
print "hello, world"
t = Timer(30.0, hello)
t.start() # after 30 seconds, "hello, world" will be printed
Can you explain in more detail what your purpose is?
Depending on what you're doing, a system utility like cron
might be what you want.