I am a student studying Python in Korea. I found strange thing while studying through idle

Chris Warrick kwpolska at gmail.com
Fri Mar 9 14:49:07 EST 2018


On 9 March 2018 at 01:07, 노연수 <clear0755 at naver.com> 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. However, if you type print (" hello\ rpython ") in the python 3.7.0.b2 idle, it is output as hellopython. I wonder why it prints like this. I would appreciate your answer.
>
> I have attached the file so I would appreciate your reference.
> --
> https://mail.python.org/mailman/listinfo/python-list

In both cases, 'hellopython' is printed, only the behavior of the
cursor changes. The `\r` means “move cursor to the start of the line”
in some places, including Terminal/Command Prompt. But not everyone
processes the backspace character — IDLE ignores it, as do many other
text editors.

Another important thing to note about \r is this:

>>> print("python\rhi")
hithon

(PS. it’s better to use a stable version, especially when you’re
learning. PPS. file attachments do not work on this list.)

-- 
Chris Warrick <https://chriswarrick.com/>
PGP: 5EAAEA16<div class="gmail_extra"><br><div class="gmail_quote">On
9 March 2018 at 01:07, 노연수 <span dir="ltr"><<a
href="mailto:clear0755 at naver.com"
target="_blank">clear0755 at naver.com</a>></span>
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">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. However, if you type print (" hello\
rpython ") in the python 3.7.0.b2 idle, it is output as hellopython. I
wonder why it prints like this. I would appreciate your answer.<br>
<br>
I have attached the file so I would appreciate your reference.<br>
<span class="HOEnZb"><font color="#888888">--<br>
<a href="https://mail.python.org/mailman/listinfo/python-list"
data-saferedirecturl="https://www.google.com/url?hl=en-GB&q=https://mail.python.org/mailman/listinfo/python-list&source=gmail&ust=1520708438742000&usg=AFQjCNGayj8GjRvThJd0aWdvjz6jUEPsgA"
rel="noreferrer"
target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-list</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>--
<br><div class="gmail_signature"
data-smartmail="gmail_signature">Chris Warrick <<a
href="https://chriswarrick.com/"
target="_blank">https://chriswarrick.com/</a>><br>PGP:
5EAAEA16</div>
</div>



More information about the Python-list mailing list