Pausing python programs

Martin Franklin mfranklin1 at
Thu Jan 29 16:56:10 CET 2004

On Thu, 2004-01-29 at 09:41, Graham wrote:
> How can I cause a python program to pause/suspend execution for a period of
> time?  I am checking status of an external system and only want to check
> every second as opposed to my current which checks may times a secnod and
> hogs my cpu in the process!!!
> Thank you to anyone who can help.
> Graham Smith
> PeopleSoft Technical Team Leader
> +44 (1865) 313255
gsmith at

You should really get into pydoc:-)  For example

pydoc time

Help on module time:
    time - This module provides various functions to manipulate time


    time() -- return current time in seconds since the Epoch as a float
    clock() -- return CPU time since process start as a float
    sleep() -- delay for a number of seconds given as a float
    gmtime() -- convert seconds since Epoch to UTC tuple
    localtime() -- convert seconds since Epoch to local time tuple
    asctime() -- convert time tuple to string
    ctime() -- convert time in seconds to string
    mktime() -- convert local time tuple to seconds since Epoch
    strftime() -- convert time tuple to string according to format
specification    strptime() -- parse string to time tuple according to
format specification
    tzset() -- change the local timezone

so time.sleep(1) could be what you are after.  

Also don't forget google is you friend :-)


Martin Franklin <mfranklin1 at>

More information about the Python-list mailing list