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

Richard Bow donkan7 at yahoo.com
Sat Oct 19 06:49:18 CEST 2002


Erik Max Francis <max at alcyone.com> wrote in 
news:3DB059B9.2C82FE5F at alcyone.com:

>> 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.

Yes, I'm using Win98 and IDLE, and '\b' prints as a square. 

Richard Bow






More information about the Python-list mailing list