Stephen J. Turnbull wrote: > The only cases I can remember are files named things like > "thesis.doc.doc" in GUI environments. ;-)
For edge cases like that, something like `"thesis.doc.doc".removesuffix(".doc").removesuffix(".doc")` should suffice, no? It may not be the cleanest looking solution, but IMO, it's better than over-complicating the method for something that would be used rarely at best. On Mon, Mar 23, 2020 at 1:34 AM Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp> wrote: > Paul Moore writes: > > > I've needed to remove one prefix/suffix. I've never needed to remove > > more than one. > > The only cases I can remember are files named things like > "thesis.doc.doc" in GUI environments. ;-) > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/NT3ORR6E54EW3CKJGXGCN7VJWPAG5PBX/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/3ALBB4MJG3ENCNCZ3VWHYYCOHP75O7WS/ Code of Conduct: http://python.org/psf/codeofconduct/