printing dots in simple program while waiting

Santiago Romero sromero at gmail.com
Wed Jan 9 12:55:28 EST 2008


On 9 ene, 17:48, John <john.m.ro... at gmail.com> wrote:
> 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
> .
> .

 Change

> print s

 to

> print s,

 (With the ending ",", which sends NO linefeed to stdout)

 Bye :)



More information about the Python-list mailing list