[issue33362] string strip() strips extra characters that it shouldn't

2018-04-25 Thread David Ghiurco
David Ghiurco added the comment: Thanks guys. I should have used .replace(). My bad. -- ___ Python tracker ___

[issue33362] string strip() strips extra characters that it shouldn't

2018-04-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: the argument to string.strip (also lstrip and rstrip) is not an exact substring to remove, but a set of characters to remove: py> 'zyxzz1234'.strip('xyz') '1234' -- nosy: +steven.daprano resolution: -> not a bug stage:

[issue33362] string strip() strips extra characters that it shouldn't

2018-04-25 Thread pmpp
pmpp added the comment: lstrip(chars=None, /) method of builtins.str instance Return a copy of the string with leading whitespace removed. If chars is given and not None, remove characters in chars instead. all L D A / single chars get removed, while there is

[issue33362] string strip() strips extra characters that it shouldn't

2018-04-25 Thread David Ghiurco
New submission from David Ghiurco : No PR is attached since the issue is pretty trivial to reproduce but important nonetheless: string = "LDA/AIC2/1919uc1b354363457" print(string) print(string.lstrip("LDA/")) the stripped string should be "AIC2/1919uc1b354363457" but is