Bug in string.lstrip?
news at NOwillmcguganSPAM.com
Mon Aug 23 18:19:23 CEST 2004
> Hello - has anyone else had trouble with string.lstrip stripping too
> much? Here's what I get (Python 2.3.4):
> >>> import string
> >>> string.lstrip("test/one/two/a.b.c", "test/one/")
> >>> string.lstrip("test/one/two/a.b.c", "test/one")
> >>> string.lstrip("test/one/two/a.b.c", "test/one/tw")
> Similar things happened with the strip() string method. Am I missing
> something, or should I file a bug report?
I think lstrip() just removes the characters that are contained in the
second string. The order of characters in the second string is irrelevant.
>>> "abcdefg".lstrip("bac" )
Your examples are correct because it removes a run of any of the
characters contained in the seconds string.
Perhaps someone can explain this better than I can. ;)
More information about the Python-list