In python how to remove one or more trailing characters of a string?