printing dots in simple program while waiting

Alex VanderWoude alex at computronix.com
Thu Jan 10 00:49:15 EST 2008


John wrote:
> 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.

When issuing output to stdout I have do something like this:

print "working",   # Note trailing comma
while some_condition:
     do_something()
     print "\b.",   # \b is backspace
print   # Finish the line of dots

- Alex



More information about the Python-list mailing list