Discussion:
Printing dots in sequence ('...')
beertje
2007-05-23 10:46:12 UTC
Permalink
[...]
maybe this: (on Win32, don't know about *nix)
print '.\b',
print '\b.',
--
rzed
print '.\b' gives a nice and funky output though... Thanks for your
suggestions, all!
Larry Bates
2007-05-22 14:10:18 UTC
Permalink
This is a very newbie question for my first post, perhaps
appropriately.
I want to print '....' gradually, as a progress indicator. I have a
print '.',
This results in something like 'Loading. . . .', whereas I want
'Loading....'
A pet peeve, I can't for the life of me figure out how to get this
desired output. How do I print dots - or anything for that matter - in
sequence without a space being inserted in between?
Thanks.
Bj?rn
I wrote this a donated to Python Cookbook some time ago, enjoy.

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/299207

-Larry
Tim Williams
2007-05-22 14:55:42 UTC
Permalink
This is a very newbie question for my first post, perhaps
appropriately.
I want to print '....' gradually, as a progress indicator. I have a
print '.',
This results in something like 'Loading. . . .', whereas I want
'Loading....'
A pet peeve, I can't for the life of me figure out how to get this
desired output. How do I print dots - or anything for that matter - in
sequence without a space being inserted in between?
maybe this: (on Win32, don't know about *nix)

for x in range(10):
print '.\b',
--
Tim Williams
beertje
2007-05-22 08:49:03 UTC
Permalink
Perfect, thanks :)
Larry Bates
2007-05-22 14:19:13 UTC
Permalink
This is a very newbie question for my first post, perhaps
appropriately.
I want to print '....' gradually, as a progress indicator. I have a
print '.',
This results in something like 'Loading. . . .', whereas I want
'Loading....'
A pet peeve, I can't for the life of me figure out how to get this
desired output. How do I print dots - or anything for that matter - in
sequence without a space being inserted in between?
Thanks.
Bj?rn
See example here:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/299207

-Larry
Peter Otten
2007-05-22 08:21:24 UTC
Permalink
This is a very newbie question for my first post, perhaps
appropriately.
I want to print '....' gradually, as a progress indicator. I have a
print '.',
This results in something like 'Loading. . . .', whereas I want
'Loading....'
A pet peeve, I can't for the life of me figure out how to get this
desired output.
I love understatement.
How do I print dots - or anything for that matter - in
sequence without a space being inserted in between?
import sys, time
... sys.stdout.write(".")
... sys.stdout.flush()
... time.sleep(.1)
...
..........>>>

write() does the writing, flush() is to defeat the buffering; without it the
dots would be withhold until the next newline. The time.sleep() call is
that you can see it is actually one dot at a time.

Peter
rzed
2007-05-23 01:36:11 UTC
Permalink
"Tim Williams" <tim at tdw.net> wrote in
news:mailman.8029.1179845747.32031.python-list at python.org:

[...]
maybe this: (on Win32, don't know about *nix)
print '.\b',
better:
print '\b.',
--
rzed
beertje
2007-05-22 08:02:31 UTC
Permalink
This is a very newbie question for my first post, perhaps
appropriately.

I want to print '....' gradually, as a progress indicator. I have a
for-loop that every 10 steps executes:
print '.',

This results in something like 'Loading. . . .', whereas I want
'Loading....'

A pet peeve, I can't for the life of me figure out how to get this
desired output. How do I print dots - or anything for that matter - in
sequence without a space being inserted in between?

Thanks.
Bj?rn

Loading...