How to print a string one char at a time, with no spaces?

Erik Max Francis max at alcyone.com
Fri Oct 18 14:58:01 EDT 2002


Andrew Thompson wrote:

> You should find that a '\b' produces a backspace.
> 
> So instead of
> '
> print pi[k],
> 
> you could write
> 
> print '\b'+pi[k],
> 
> voila.

Depending on your terminal, this might not do what you expect.  A far,
far superior solution is not printing the extraneous space in the first
place rather than trying to backspace over it afterward; print the
digits with sys.stdout.write instead.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ There is nothing stronger in the world than gentleness.
\__/ Han Suyin
    ZOE / http://www.alcyone.com/pyos/zoe/
 A simple Python OpenGL rendering engine.



More information about the Python-list mailing list