[issue42313] rstrip removes the trailing `e`s.

2020-11-10 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

For 3.9+, you could do exactly what you want with .removesuffix 
(/.removeprefix) methods;
>>> test = "external_e_object"
>>> test.removesuffix("_object")
'external_e'

--
nosy: +BTaskaya

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42313] rstrip removes the trailing `e`s.

2020-11-10 Thread Zachary Ware


Zachary Ware  added the comment:

See https://docs.python.org/3/library/stdtypes.html#str.rstrip

The `{l,r,}strip` methods remove all characters contained in the passed-in 
string; `"aabbccddeeffgg".rstrip("gfe") == "aabbccdd"`

--
nosy: +zach.ware
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42313] rstrip removes the trailing `e`s.

2020-11-10 Thread Athul R


New submission from Athul R :

rstrip removes the trailing `e`s. 

i = "external_e_object"
i = i.rstrip('_object')
print(i) 
"""
It should have printed `external_e` but it prints only `external_`. 
"""

It happens only when I user rstrip("_object") not for other strings. 

# ===
# it works fine in the below case. 


i = "external_e_trail"
i = i.rstrip('_trail')
print(i) 
"""
It should have prints `external_e`
"""

--
components: Library (Lib)
files: python-bug.py
messages: 380678
nosy: Athul-R
priority: normal
severity: normal
status: open
title: rstrip removes the trailing `e`s.
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49590/python-bug.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com