Guest User

Untitled

a guest
Aug 17th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. '''
  2. * Implement a job scheduler which takes in a function f and an integer n, and * calls f after n milliseconds.
  3. '''
  4. import sched, time
  5. s = sched.scheduler(time.time, time.sleep)
  6. def print_time(): print ("From print_time", time.time())
  7.  
  8. def job_scheduler(f,n):
  9. s.enter(n, 1, f, ())
  10. s.run()
  11.  
  12. job_scheduler(print_time, 10)
Add Comment
Please, Sign In to add comment