[Tutor] carriage return on windows

Victor Rex apple_py at biz-experts.net
Tue Feb 1 01:01:59 CET 2005


Orri Ganel wrote:

> Jacob S. wrote:
>
>> Thanks Kent and Max!!!!!
>>
>> Wow, I didn't know it did that. I'm too dumb to figure it out on my 
>> own I guess...
>> Oh well! I found a cool new thing to play with at least!
>>
>> Thanks,
>> Jacob
>>
>>
>>
>>>
>>> On Jan 30, 2005, at 02:40, Jacob S. wrote:
>>>
>>>> I don't think that's what he wants. I think he wants to *overwrite* 
>>>> what's in the shell with new output.
>>>> For example.
>>>>
>>>>
>>>> so that the whole line is overwritten. In my experience, this is 
>>>> not possible and if anyone can show me how to do it,
>>>> I would be grateful.
>>>>
>>>> HTH,
>>>> Jacob
>>>
>>>
>>>
>>> It *is* possible, that's exactly what my code does (well, as long as 
>>> you don't run it on Mac OS 9). The carriage return (\r, as opposed 
>>> to the linefeed \n) moves the cursor to the beginning of the 
>>> *current* line.
>>>
>>> -- Max
>>> maxnoel_fr at yahoo dot fr -- ICQ #85274019
>>> "Look at you hacker... A pathetic creature of meat and bone, panting 
>>> and sweating as you run through my corridors... How can you 
>>> challenge a perfect, immortal machine?"
>>>
>>>
>>>
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> http://mail.python.org/mailman/listinfo/tutor
>>
> Just a note: This does not work on IDLE, so for those who try this and 
> are frustrated when it fails, try it in the dos-box (command prompt).
>
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.

Do you happen to know how this in done?
Thanks.
Victor

worked around this problem and I love the solution.


More information about the Tutor mailing list