On Sun, 8 Mar 2009 01:59:03 -0800
Chris Rebert <[email protected]> wrote:
> > etc taking up lots and lots of lines of output... So, how can I make it
> > write the percentage on the same line eg.
> Use the carriage return character to overwrite the line (you'll need
> to forego `print`):
Why do you say that?
> from sys import stdout
> while working:
> stdout.write('\r'+percent)
while working:
print '\r'+percent,
> Note that you'll need to ensure that `percent` has constant length
> throughout the loop.
Nope. You just need to make sure that it never gets shorter which is
the case here. If it wasn't then:
while working:
print '\r'+percent+' ',
--
D'Arcy J.M. Cain <[email protected]> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
--
http://mail.python.org/mailman/listinfo/python-list