[New-bugs-announce] [issue45617] sys.stdin does not iterate correctly on '\r' line separator
Kelly Brazil
report at bugs.python.org
Tue Oct 26 15:20:29 EDT 2021
New submission from Kelly Brazil <kellyjonbrazil at gmail.com>:
When iterating on sys.stdin lines, '\r\n' and '\n' are handled correctly, but '\r' is not handled, though it is documented that it should be supported.
Example code:
import sys
for line in sys.stdin:
print(repr(line))
Results in Python 3.8.9:
$ echo -e 'line1\nline2\nline3' | python3 linetest.py
'line1\n'
'line2\n'
'line3\n'
$ echo -e 'line1\r\nline2\r\nline3' | python3 linetest.py
'line1\r\n'
'line2\r\n'
'line3\n'
$ echo -e 'line1\rline2\rline3' | python3 linetest.py
'line1\rline2\rline3\n'
----------
messages: 405057
nosy: kbrazil
priority: normal
severity: normal
status: open
title: sys.stdin does not iterate correctly on '\r' line separator
type: behavior
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45617>
_______________________________________
More information about the New-bugs-announce
mailing list