How to clear previous console output?
Terry Reedy
tjreedy at udel.edu
Mon Aug 2 21:10:33 EDT 2004
"Mike Rovner" <mike at nospam.com> wrote in message
news:cem9bk$200$1 at sea.gmane.org...
> (For console output) Use \r.
>
> Example:
>
> for i in range(100):
> print '%s\r' % ' '*20, # clean up row
> print '%d%%' % i, # note ending with comma
> print
>
> Note that it works only in real console window, not in simulated one
(like
> in WinIDE).
> That is cross-platform.
If you do not want to erase everything, \10 in string inserts backspace
character, but blanking and rewriting everything may be easier.
tjr
More information about the Python-list
mailing list