Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- * Implement a job scheduler which takes in a function f and an integer n, and * calls f after n milliseconds.
- '''
- import sched, time
- s = sched.scheduler(time.time, time.sleep)
- def print_time(): print ("From print_time", time.time())
- def job_scheduler(f,n):
- s.enter(n, 1, f, ())
- s.run()
- job_scheduler(print_time, 10)
Add Comment
Please, Sign In to add comment