Message405057
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' |
|
Date |
User |
Action |
Args |
2021-10-26 19:20:29 | kbrazil | set | recipients:
+ kbrazil |
2021-10-26 19:20:29 | kbrazil | set | messageid: <1635276029.13.0.174464623283.issue45617@roundup.psfhosted.org> |
2021-10-26 19:20:29 | kbrazil | link | issue45617 messages |
2021-10-26 19:20:29 | kbrazil | create | |
|