How can I waste time ?

Discussion in 'Python' started by Ben Finney, Feb 19, 2004.

  1. Ben Finney

    Ben Finney Guest

    On 18 Feb 2004 19:35:55 -0800, Richard Shea wrote:
    > I want my script to pause for a pre-determined number of seconds. How
    > do you do that ?


    What you want is to send your application to sleep for a specified time.

    <http://www.python.org/doc/lib/module-time.html#l2h-1763>

    --
    \ "I went to a garage sale. 'How much for the garage?' 'It's not |
    `\ for sale.'" -- Steven Wright |
    _o__) |
    Ben Finney <http://bignose.squidly.org/>
     
    Ben Finney, Feb 19, 2004
    #1
    1. Advertising

  2. Ben Finney

    Richard Shea Guest

    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.
     
    Richard Shea, Feb 19, 2004
    #2
    1. Advertising

  3. Ben Finney

    Ken Godee Guest

    Richard Shea wrote:
    > 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)
     
    Ken Godee, Feb 19, 2004
    #3
  4. Ben Finney

    Paul Rubin Guest

    (Richard Shea) writes:
    > I want my script to pause for a pre-determined number of seconds. How
    > do you do that ?


    import time
    time.sleep(3) # sleep 3 seconds
     
    Paul Rubin, Feb 19, 2004
    #4
  5. Ben Finney

    Richard Shea Guest

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

    thanks again

    richard shea.
     
    Richard Shea, Feb 19, 2004
    #5
  6. Richard Shea wrote:

    > 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 )

    --
    Chris Herborth
    Documentation Overlord, CRYPTOCard Corp. http://www.cryptocard.com/
    Never send a monster to do the work of an evil scientist.
     
    Chris Herborth, Feb 19, 2004
    #6
  7. Paul Rubin wrote:

    > (Richard Shea) writes:
    >
    >>I want my script to pause for a pre-determined number of seconds. How
    >>do you do that ?

    >
    >
    > 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).

    --
    -Scott David Daniels
     
    Scott David Daniels, Feb 20, 2004
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sharp

    Generics is a waste of time

    Sharp, May 15, 2005, in forum: Java
    Replies:
    21
    Views:
    874
    Tim Ward
    May 18, 2005
  2. asincero
    Replies:
    24
    Views:
    621
    Antoon Pardon
    Aug 29, 2006
  3. Hendrik van Rooyen

    Fw: Is this a good idea or a waste of time?

    Hendrik van Rooyen, Aug 25, 2006, in forum: Python
    Replies:
    2
    Views:
    293
    Hendrik van Rooyen
    Aug 26, 2006
  4. llothar

    Is using splint a waste of time ?

    llothar, Mar 4, 2007, in forum: C Programming
    Replies:
    6
    Views:
    2,009
    Randy Howard
    Mar 11, 2007
  5. Cindy Lee

    .NET MVC = waste of time

    Cindy Lee, Oct 1, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    628
    Fernando A. Gómez F.
    Nov 21, 2008
Loading...

Share This Page