This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: strip() is removing an extra character if the strip pattern contains "-"
Type: behavior Stage: resolved
Components: Library (Lib) Versions: 3rd party
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Balachander.Ganesan, r.david.murray
Priority: normal Keywords:

Created on 2010-05-12 18:29 by Balachander.Ganesan, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg105598 - (view) Author: Balachander Ganesan (Balachander.Ganesan) Date: 2010-05-12 18:29
Version:
========
Python 2.4.3 (#1, Jan 14 2008, 18:31:21)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2

Description:
============
When the pattern used for strip contains "-" character then it removes one more characters next to it.

>>> a = 'image-abc-1.2.0-12_1234_123'
>>> b = a.strip('image-')
>>> print b
bc-1.2.0-12_1234_123


From the above print statement we can see that instead of 'bc-1.2.0-12_1234_123', it prints only 'bc-1.2.0-12_1234_123'. 
The first character "a" next to "-" is missing.
msg105599 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-05-12 18:31
The argument to strip is a set of characters to remove, not a substring.
History
Date User Action Args
2022-04-11 14:57:00adminsetgithub: 52946
2010-05-12 18:31:24r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg105599

resolution: not a bug
stage: resolved
2010-05-12 18:29:37Balachander.Ganesancreate