\r functionality

Fredrik Lundh fredrik at pythonware.com
Tue May 17 10:46:29 EDT 2005


"Jake" <jacob.hurst at gmail.com> wrote:

> in c and c++ there is a useful way to refresh an output line in printf
> and cout using \r meta command.

that's a control character that's printed to the terminal by printf/cout,
not a "C or C++ meta command"

to print the same character in Python, use the same character escape:

    print "\r", count,

(note that if this works or not depends on the terminal you're sending the
output to.  most ordinary terminals handle it just fine, but if you're sending
output to an IDE console window, it may not work as expected)

</F> 






More information about the Python-list mailing list