A Simple Scheduler in Python

Posted on 📅 April 3, 2019

We all encounter things in life which we want to automate, Setting up reminders and schedules are one of them
Python makes it easy for all the developers out there to make small python scripts that can schedule some boring stuff for you.

Here comes this #awesome library called schedule
(quite a name it got there :wink:)

Let’s start around by playing with this

Installation

First things first let us install the python package first

pip install schedule  

Introduction

schedule is an in-process scheduler for periodic jobs that uses the builder pattern for configuration. Schedule lets you run Python functions (or any other callable) periodically at predetermined intervals using a simple, human-friendly syntax.

Python job scheduling for humans.

Let’s not worry about what in-process scheduling is for now
Let’s write some code

import schedule  
  
def job():  
    print("A Simple Python Scheduler.")  
  
# run the function job() every 2 seconds  
schedule.every(2).seconds.do(job)  
  
while True:  
    schedule.run_pending()