In Python programming function you can use sleep() function available under time module. This will sleep or delay script execution for the defined number of seconds.
You can use time.sleep(seconds) as per following. The value passed to sleep() function is in second.
Python Delay Example
Let’s create a small script to print current date time every after 5 seconds.
Execute above script on command line. To exit running script press CTRL + C. You will see results something like below
DateTime Fri Sep 28 17:39:50 2018 DateTime Fri Sep 28 17:39:55 2018 DateTime Fri Sep 28 17:40:00 2018 DateTime Fri Sep 28 17:40:05 2018 DateTime Fri Sep 28 17:40:10 2018