Patrick Maupin added the comment: Example >>> text = 'test1/1.jp2' >>> text.rstrip('.2jp') 'test1/1' ---------- _______________________________________ Python tracker <report at bugs.python.org> <http://bugs.python.org/issue24445> _______________________________________