Re printing on same line.

Jerry Hill malaclypse2 at gmail.com
Fri Jun 15 12:57:47 EDT 2007


On 6/15/07, HMS Surprise <john at datavoiceint.com> wrote:
> I want to print a count down timer on the same line. I tried
>
>     print '\r', timeLeft,
>
> which just appends to the same line.

Sounds to me like whatever you're printing to doesn't do what you
expect when it encounters a carriage return (\r).  Is your program
running in a terminal?  Both the windows cmd.exe shell and bash under
linux seem to do the right thing when encountering a '\r'.

On the other hand, running the same code in IDLE doesn't work right,
presumably because the text window doesn't really know what to do with
a bare carriage return.

-- 
Jerry



More information about the Python-list mailing list