Python 2.5 in Windows XP
I'm trying to learn about getting one's code to work at a certain time. I have some questions regarding what i've read from http://www.python.org/doc/current/lib/module-sched.html. If anyone could help that'd be great. Below is the sample code provided from the link above:
Questions:
1. whenever I do a scheduled event should I have this line?
s=sched.schedul er(time.time, time.sleep)
2. In...s.enter(5, 1, print_time, ())
What does the 5 and 1 represent? Possibly how long to wait before doing the function and how long it lasts?
That's all for now, i'm sure I"ll have follow ups.
Thanks
PC
I'm trying to learn about getting one's code to work at a certain time. I have some questions regarding what i've read from http://www.python.org/doc/current/lib/module-sched.html. If anyone could help that'd be great. Below is the sample code provided from the link above:
Code:
>>> import sched, time >>> s=sched.scheduler(time.time, time.sleep) >>> def print_time(): print "From print_time", time.time() ... >>> def print_some_times(): ... print time.time() ... s.enter(5, 1, print_time, ()) ... s.enter(10, 1, print_time, ()) ... s.run() ... print time.time() ... >>> print_some_times()
1. whenever I do a scheduled event should I have this line?
s=sched.schedul er(time.time, time.sleep)
2. In...s.enter(5, 1, print_time, ())
What does the 5 and 1 represent? Possibly how long to wait before doing the function and how long it lasts?
That's all for now, i'm sure I"ll have follow ups.
Thanks
PC
Comment