printing dots in simple program while waiting

John john.m.roach at gmail.com
Wed Jan 9 17:48:46 CET 2008


Ok, so this should be a really simple thing to do, but I haven't been
able to get it on the first few tries and couldn't find anything after
searching a bit.

what i want to do is print a 'waiting' statement while a script is
working-- the multithreading aspect isn't an issue, the printing on
the same line is.  i want to print something like:

(1sec) working...
(2sec) working....
(3sec) working.....


where the 'working' line isn't being printed each second, but the dots
are being added with time.

something like:

import time
s = '.'
print 'working'
while True:
    print s
    time.sleep(1)


however, this doesn't work since it prints:

working
.
.
.

any suggestions?



More information about the Python-list mailing list