Printing to console (No Scroll)

Derek none at none.com
Wed Jan 14 20:34:48 CET 2004


"Diez B. Roggisch" wrote
> > Any alternatives to ncurses? It seems like a overkill for this...
>
> Maybe you can use sys.stdout.write in conjunction with control-
> codes for moving back the cursor to column one. But you'll have
> to lookup these for yourself :)

I think \r is the control code (at least if you want to go back to the
start of the line):

import time, sys
for second in range(10):
     time.sleep(1)
     sys.stdout.write(`10-second` + " seconds \r")
     sys.stdout.flush()





More information about the Python-list mailing list