[issue34859] python core in string substring search

Raymond Hettinger report at bugs.python.org
Mon Oct 1 05:21:21 EDT 2018


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

The test code for the third case looks incorrect in two places:

Given:       if str.find("\n\r"):                  
                                ^-- should compare to -1     
                          ^^^^----- these are reversed

Corrected:   if str.find("\r\n") != -1:

Also note that *str* is a confusing variable name because it shadows the builtin *str*.

----------
nosy: +rhettinger

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


More information about the Python-bugs-list mailing list