with _schedule_2.py 762 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. __author__ = "heider"
  4. __doc__ = r"""
  5. Created on 8/22/22
  6. """
  7. __all__ = []
  8. import schedule
  9. import time
  10. def job():
  11. print("I'm working...")
  12. schedule.every(10).seconds.do(job)
  13. schedule.every(10).minutes.do(job)
  14. schedule.every().hour.do(job)
  15. schedule.every().day.at("10:30").do(job)
  16. schedule.every(5).to(10).minutes.do(job)
  17. schedule.every().monday.do(job)
  18. schedule.every().wednesday.at("13:15").do(job)
  19. schedule.every().day.at("12:42", "Europe/Amsterdam").do(job)
  20. schedule.every().minute.at(":17").do(job)
  21. def job_with_argument(name):
  22. print(f"I am {name}")
  23. schedule.every(10).seconds.do(job_with_argument, name="Peter")
  24. while True:
  25. schedule.run_pending()
  26. time.sleep(1)