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: Rstrip Incorrectly Strips Some Strings
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, ezio.melotti, mkubilus
Priority: normal Keywords:

Created on 2009-06-26 18:58 by mkubilus, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg89736 - (view) Author: Matt Kubilus (mkubilus) Date: 2009-06-26 18:58
Rstrip has unexpected behavior with some strings.  Example:

-----

>>> "proxa.py".rstrip(".py")
'proxa'
>>> "proxy.py".rstrip(".py")
'prox'

-----

Tested with Python 2.6.1
msg89737 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-06-26 19:02
This is expected. rstrip() strips a set of characters, not a string.
msg89742 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2009-06-26 21:15
And you should probably use
http://docs.python.org/library/os.path.html#os.path.splitext instead of
.rstrip().
History
Date User Action Args
2022-04-11 14:56:50adminsetgithub: 50595
2009-06-26 21:15:06ezio.melottisetnosy: + ezio.melotti
messages: + msg89742
2009-06-26 19:02:23benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg89737

resolution: not a bug
2009-06-26 18:58:19mkubiluscreate