78 <78alphadevi...@gmail.com> added the comment:
I have read the documentation. It didn't function near what I thought it did. I've never heard it stripping front and back characters in tutorials. I solely admit I was wrong in assuming its function. On Sat, Mar 30, 2019, 3:35 PM Eric V. Smith <rep...@bugs.python.org> wrote: > > Eric V. Smith <e...@trueblade.com> added the comment: > > I cannot run that example on my computer. > > Please reduce this to a single line of code, with no imports, that calls > .strip() and shows your problem. Ideally you will just use constants, and > not computed strings. > > Something like: > > >>> 'magenta.zip'.strip('pizamn') > 'genta.' > > And also, show that exact same line of code executed on both platforms. > > That said, the problem is likely in your usage of .strip(). Please re-read > the documentation: it does not remove substrings from a given string, it > removes any of the given characters from the beginning and end of the > string. > > So, this is correct: > >>> 'magenta.zip'.strip('pm') > 'agenta.zi' > > You're probably seeing some difference due to upper or lower case > filenames on the two platforms. > > ---------- > > _______________________________________ > Python tracker <rep...@bugs.python.org> > <https://bugs.python.org/issue36480> > _______________________________________ > ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36480> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com