How to clear previous console output?
Mike Rovner
mike at nospam.com
Mon Aug 2 16:48:55 EDT 2004
(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.
HTH,
Mike
Newgene wrote:
> I want to show the progress by print 1% to 100%. But I hope each
> output will clear the previous output before print, so that I can see
> a dynamic updated display of percentage, instead of print all
More information about the Python-list
mailing list