[Tutor] carriage return on windows

Kent Johnson kent37 at tds.net
Tue Feb 1 01:18:28 CET 2005


Victor Rex wrote:
> I played around with this output issue and I love the way it works.
> Now, how do you do this in *nix? I tried the same approach and I get a 
> blank line for 5 seconds (or whatever number of cycles you have on your 
> example) and the a final line with the last value of the iterable.

It sounds like the '\r' is erasing the line, not just moving the cursor. Try putting the '\r' at the 
beginning of the output rather than the end:

for i in range(10):
   print '\r', 'i is', i
   time.sleep(1)

Kent



More information about the Tutor mailing list