python remove spaces from string end code example Example: python trim whitespace from end of string >>> " xyz ".rstrip() ' xyz'