The Scheduler of Python
Scheduling any task with python is much easier using this library. There are some exciting methods available in the library. Even though there are many ways you can schedule a task, this is an exciting way. Libraries make Python enjoyable. Read on to learn about this schedular library.
Installation: pip install scheduler
Some Interesting Methods available in this library are:
1. schedule.every(interval)
We can schedule a regular job that can be a function instance based on the interval required with this method.
import schedule
import time
def printing():
print("Im working now")
schedule.every(1).seconds.do(printing)
while True:
schedule.run_pending()
time.sleep(1)
2. schedule.run_pending()
This method helps run all the pending jobs that are scheduled.
Syntax: schedule.run_pending()
3. schedule.cancel_job()
This method is helpful to stop a scheduled task from getting executed for your convenience.
import schedule
import time
def working():
print("Im working now")
def holiday():
print("Im on holiday")…