[New-bugs-announce] [issue33362] string strip() strips extra characters that it shouldn't

David Ghiurco report at bugs.python.org
Wed Apr 25 22:50:46 EDT 2018


New submission from David Ghiurco <dm.ghiurco at gmail.com>:

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 instead "IC2/1919uc1b354363457"

notice the leading "A" missing.

I've noticed this happens when the letter immediately following the slash is the same letter as the one immediately before the slash. Never contributed to python so I'm not exactly sure how to, but if anyone knowledgeable could take a look, this will probably be an easy fix.

Note: I am experiencing this on Python 3.6.4, specifically the Anaconda distribution. I have not tried another version.

----------
messages: 315771
nosy: rahvan
priority: normal
severity: normal
status: open
title: string strip() strips extra characters that it shouldn't
versions: Python 3.6

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


More information about the New-bugs-announce mailing list