[issue24445] rstrip strips what it doesn't have to

2015-06-13 Thread o1da
o1da added the comment: Ok, thank you. I thought it trims whole sequence or nothing. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24445 ___

[issue24445] rstrip strips what it doesn't have to

2015-06-13 Thread Patrick Maupin
Patrick Maupin added the comment: Example text = 'test1/1.jp2' text.rstrip('.2jp') 'test1/1' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24445 ___

[issue24445] rstrip strips what it doesn't have to

2015-06-13 Thread Patrick Maupin
Patrick Maupin added the comment: I think you misunderstand rstrip -- it works from the right, and checks to see if the right-most character is in the string you have given it. As long as it is, then it will remove the character and loop -- nosy: +Patrick Maupin

[issue24445] rstrip strips what it doesn't have to

2015-06-13 Thread o1da
New submission from o1da: Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type help, copyright, credits or license for more information. text = 'test1/1.jp2' text.rstrip('.jp2') 'test1/1' text = 'test1.jp2' text.rstrip('.jp2') 'test1' text = 'test1/2.jp2'

[issue24445] rstrip strips what it doesn't have to

2015-06-13 Thread Martin Panter
Martin Panter added the comment: The 3.5 documentation of str.strip() was recently modified in Issue 24204 due to this kind of misunderstanding. Perhaps other versions should be modified as well, or the str.l/rstrip() methods, or the bytes() and bytearray() methods. See also Issue 23560