Print formatting - same line printing?

Bablos angband at blueyonder.co.uk
Sun Jun 4 07:26:27 EDT 2000


On 4 Jun 2000 11:16:47 GMT, Remco Gerlich wrote;
> > Is there a way that I can get Python to print this all on the same
> > line, so that it looks as if the line is being updated constantly, as
> > opposed to having a ridiculously long list of 'uploaded...' lines?
> > 
> > Hope someone can help.
> 
> Print, sys.stdout.write and so on all just push bytes into stdout. Any
> tricks you could use to do this are very platform dependent. However, maybe
> printing a lot of ^Hs to clear a line will work; see what

I've managed to get it to work by adding '\v', a vertical tab to the
beginning of each line.  I've tried adding lots of backspaces, but it
doesn't solve my problem.  I've tried adding a '\r' to the beginning
of the line, and suppressing the newline at the end, but under the
Amiga the printing output is then buffered and flushed for some
reason, so I get the required effect, but due to the buffering, I only
see about 1 in 15 messages.

> Nice to see people from the Angband world here, btw :-)

Oh, I'm flexing my Python wings this weekend.  Now that the potential
of Kang has disappeared, I'm doing a bit of programming as a stepping
stone before wading waist deep into Zang's scripting ;o)


Bablos.



More information about the Python-list mailing list