sleep() function, perhaps.

vincent wehren vincent at visualtrans.de
Tue Nov 25 01:10:17 EST 2003


"Ryan Spencer" <jeder at earthlink.net> schrieb im Newsbeitrag
news:pan.2003.11.25.05.26.36.747748 at earthlink.net...
|
| Hello Everyone,
|
| I want to have a row of periods, separated by small, say, .5 second
| intervals between each other. Thus, for example, making it have the
| appearance of a progress "bar".
|
| [code]
| import time
|
| sleep(.5)
| print "."
| sleep(.5)
| print "."
| [end code]
|
| But, it would (with those .5 second intervals)
| print out much like the following.

|
| .
| (pause)
| .
| (pause)
|
| I would rather those periods be on a single line, not printing on a new
| line each time.

import time,sys

while 1:
    sys.stdout.write(".")
    time.sleep(0.5)

You could also use:

   print ".",

(note the trailing comma)

but that will leave you with an additional space after the dot

HTH,

Vincent Wehren
| Any suggestions?
|
| Thank you in advance,
| ~Ryan
|






More information about the Python-list mailing list