python string remove spaces at end code example Example: python remove spaces from string >>> " ".join(s.split()) 'Hello World From Pankaj Hi There'