Batuhan Taskaya <isidenti...@gmail.com> added the comment:
For 3.9+, you could do exactly what you want with .removesuffix (/.removeprefix) methods; >>> test = "external_eeeeeeeee_object" >>> test.removesuffix("_object") 'external_eeeeeeeee' ---------- nosy: +BTaskaya _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42313> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com