How can I waste time ?

R

Richard Shea

I'm sure this is a very simple question but I can't find an answer in
the archives.

I want my script to pause for a pre-determined number of seconds. How
do you do that ? I've found 'pause()' although it sounds awfully deep
for what I want and what's more it doesn't work on W32 (I'm developing
on W32 but will run on *nix).

Oh yes one other thing - I could write a loop and keep checking the
sytem clock but I would prefer for the process to just get out of the
way to allow others things access to the CPU.

As I say I'm sure it's dead simple but how ?

thanks

richard shea.
 
K

Ken Godee

Richard said:
I'm sure this is a very simple question but I can't find an answer in
the archives.

I want my script to pause for a pre-determined number of seconds. How
do you do that ? I've found 'pause()' although it sounds awfully deep
for what I want and what's more it doesn't work on W32 (I'm developing
on W32 but will run on *nix).

Oh yes one other thing - I could write a loop and keep checking the
sytem clock but I would prefer for the process to just get out of the
way to allow others things access to the CPU.

As I say I'm sure it's dead simple but how ?

thanks

richard shea.

import time
time.sleep(secs)
 
R

Richard Shea

thanks very much to all of you - just what's needed !

thanks again

richard shea.
 
C

Chris Herborth

Richard said:
I'm sure this is a very simple question but I can't find an answer in
the archives.

Try the Python Library Reference? :)
I want my script to pause for a pre-determined number of seconds. How
do you do that ? I've found 'pause()' although it sounds awfully deep
for what I want and what's more it doesn't work on W32 (I'm developing
on W32 but will run on *nix).

import time
....
time.sleep( number_of_seconds )
 
S

Scott David Daniels

Paul said:
import time
time.sleep(3) # sleep 3 seconds
Or, if you like,

import math, time

time.sleep(math.pi) # For a bit more than 3 seconds.

The point of this post is simply to make sure people realize they can
use floating point for partial seconds (but I don't know about imaginary
time).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top