[Tutor] carriage return on windows
Jacob S.
keridee at jayco.net
Sun Jan 30 03:40:10 CET 2005
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.
Python 2.4 (#Stuff)
...
>>>
Percent complete: 50
becomes...
Python2.4(#Stuff)
...
>>>
Percent complete: 51
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
>
> On Jan 30, 2005, at 02:18, R. Alan Monroe wrote:
>
>>
>>> print "Percent completed:" + str(percent) + "\r"
>>
>> Print forces a newline.
>> Try sys.stdout.write instead.
>>
>> Alan
>
> You can also use the following syntax:
>
> >>> print "Percent completed:", str(percent), "\r",
>
> The trailing comma is NOT a typo, it is intentional. It prevents print
> from appending a newline.
>
> -- 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
>
>
More information about the Tutor
mailing list