[New-bugs-announce] [issue34859] python core in string substring search

pashkasan report at bugs.python.org
Mon Oct 1 01:55:43 EDT 2018


New submission from pashkasan <pavel at pmbox.biz>:

find substring in string 
its correct behavior?
sample code

str = """
Content-Length: 3192
Connection: close
Cookie: _secure_admin_session_id=2a5dc26329de17ca4eafxxxxxxxxxxxxe;

-----------------------------1477319126846
Content-Disposition: form-data; name="utf8"
"""
str2 = """
xxxx

zzzzz


tttttt
"""

if "\r\n" in str:
        print ("str found")
else:
        print ("str not found")


if "\r\n" in str2:
        print ("str2 found")
else:
        print ("str2 not found")


if str.find("\n\r"):
        print ("str found")
else:
        print ("str not found")

output

[root at scw-6ec0de ~]# python a.py
str not found
str2 not found
str found
[root at scw-6ec0de ~]# python3 a.py
str not found
str2 not found
str found
[root at scw-6ec0de ~]# python --version
Python 2.7.15
[root at scw-6ec0de ~]# python3 --version
Python 3.6.4
[root at scw-6ec0de ~]#

----------
components: Interpreter Core
messages: 326764
nosy: pashkasan
priority: normal
severity: normal
status: open
title: python core in string substring search
versions: Python 2.7, Python 3.6

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


More information about the New-bugs-announce mailing list