[New-bugs-announce] [issue26447] rstrip() is pilfering my 'p'

Jerod “j3rd” Gawne report at bugs.python.org
Fri Feb 26 15:44:07 EST 2016


New submission from Jerod “j3rd” Gawne:

Python 3.5.1 (v3.5.1:37a07cee5969, Dec  6 2015, 01:54:25) [MSC v.1900 64 bit (AMD64)] on win32

In[4]: str = 'aaaaaaap.py'
In[5]: print(str.rstrip('.py'))
aaaaaaa

In[6]: str = 'aaaaaaap.pdf'
In[7]: print(str.rstrip('.pdf'))
aaaaaaa

In[8]: str = 'aaaaaaab.pdf'
In[9]: print(str.rstrip('.pdf'))
aaaaaaab

In[10]: str = 'apapapab.pdf'
In[11]: print(str.rstrip('.pdf'))
apapapab

In[12]: str = 'apapapap.pdf'
In[13]: print(str.rstrip('.pdf'))
apapapa

what's with the 'p' pilfering?

In[14]: str = 'apapapab.bdf'
In[15]: print(str.rstrip('.bdf'))
apapapa
In[16]: print(str.rstrip(r'.bdf'))
apapapa

In[18]: print(str.rstrip('\.bdf'))
apapapa

Actually though, it's grabbing an additional character before the '.' the same as the one after.

----------
messages: 260908
nosy: Jerod “j3rd” Gawne
priority: normal
severity: normal
status: open
title: rstrip() is pilfering my 'p'
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26447>
_______________________________________


More information about the New-bugs-announce mailing list