[New-bugs-announce] [issue44513] for string methods strip, lstrip, rstrip, when param is a string which has more than one char, those methods is no useful currently

redrose2100 report at bugs.python.org
Sat Jun 26 00:22:23 EDT 2021


New submission from redrose2100 <hitredrose at 163.com>:

for string methods strip, lstrip, rstrip, when param is a string which has more than 1 char, currently those methods remove char ,but not remove string , it is no useful

following is the results in python 3.9.5

Python 3.9.5 (default, May 18 2021, 14:42:02) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> s="hellolloehb"
>>> print(s.lstrip("hello"))
b
>>> s="blloehhello"
>>> print(s.rstrip("hello"))
b
>>> s="helloehhollbllohhehello"
>>> print(s.strip("hello"))
b
>>>
In fact,
when s="hellolloehb" , s.lstrip("hello") expect to get "lloehb"
when s="blloehhello" , s.rstrip("hello") expect to get "blloeh"
when s="helloehhollbllohhehello" , s.strip("hello") expect to get "ehhollbllohhe"

----------
components: Library (Lib)
messages: 396538
nosy: redrose2100
priority: normal
severity: normal
status: open
title: for string methods strip, lstrip, rstrip, when param is a string which has more than one char, those methods is no useful currently
type: behavior
versions: Python 3.9

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


More information about the New-bugs-announce mailing list