[issue38503] bug: string search can find \n, but can NEVER find \r

wang xuancong report at bugs.python.org
Thu Oct 17 04:22:02 EDT 2019


New submission from wang xuancong <xuancong84 at gmail.com>:

If I load a file which contains "\r" and "\n", I can find "\n", but not "\r". This behaviour is inconsistent in Python 3, but consistent in Python 2.

>>> open('./3cjkxdnw/accessibilityLog/1570181896323.csv', 'rb').read().count(b'\r')
88
>>> open('./3cjkxdnw/accessibilityLog/1570181896323.csv').read().count('\r')
0
>>> type(open('./3cjkxdnw/accessibilityLog/1570181896323.csv').read())
<class 'str'>
>>> type('\r')
<class 'str'>

Thanks!

----------
messages: 354834
nosy: xuancong84
priority: normal
severity: normal
status: open
title: bug: string search can find \n, but can NEVER find \r
type: behavior
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38503>
_______________________________________


More information about the Python-bugs-list mailing list