I found strange thing while studying through idle

MRAB python at mrabarnett.plus.com
Thu Mar 8 23:16:47 EST 2018


On 2018-03-09 03:57, Steven D'Aprano wrote:
[snip]

> In IDLE 3.5 on Linux, I get this:
> 
>>>> print('hello\rpython')
> hello\rpython
> 
> Curiously, that's not a backslash r, it's actually a carriage return:
> when I copy and paste it in this text, the editor treated it as a new
> line character:
> 
> # direct copy and paste becomes this in my editor
>>>> print('hello\rpython')
> hello
> python
> 
> 
> But it is possible that due to differences between platforms, the OP's
> version of IDLE doesn't display a carriage return as \r but rather as an
> invisible zero-width space.
> 
IDLE 3.6 on Windows, it looks like this:

hellopython

but when I copy and paste it into an editor I get:

hello
python



More information about the Python-list mailing list