method in python to remove spaces inside string code example Example: python remove space from end of string >>> " xyz ".rstrip() ' xyz'