I am a student studying Python in Korea. I found strange thing while studying through idle
Terry Reedy
tjreedy at udel.edu
Fri Mar 9 16:03:48 EST 2018
On 3/8/2018 7:07 PM, 노연수 wrote:
> If you type print (" hello\ rpython ") into the python 3.7.0.b2, only the python is printed and i learned it's a crystal.
'\r' is a control character than means 'return to the beginning of the
line'. When you execute "print('hello\rpython')" in Python running in
an operating system console, the effect of '\r' depends on the console.
If the console tries to emulate terminals which moved the cursor or
printing head in response to '\r', then that is what happens. The
effect of various control codes depends on the terminal emulation and
can be different on different systems.
> However, if you type print (" hello\ rpython ") in the python 3.7.0.b2 idle, it is output as hellopython.
IDLE is a cross-platform development environment and its shell is not a
terminal emulator. Requests to imitate particular terminals/consoles
have been rejected. In the case of \r and backspace, it was felt that
it is better to not erase what has been printed. If one wants to know
how a program will operate in a particular console, one should test it
there.
> I have attached the file.
Don't do this. Copy and paste relevant snippets of code into the
message. Attachments are ignored and not sent to subscribers or mirrors. -
Terry Jan Reedy
More information about the Python-list
mailing list