Removing Whitespace Characters from a String

You can use the methods in Figure 8.7 to strip whitespace characters from the front, end, or both the front and end of a string. Recall that the characters ‘ ‘, \t, \f, \r, and \n are called the whitespace characters   lstrip(): str Returns a string with the leading whitespace characters removed. rstrip(): str … Read moreRemoving Whitespace Characters from a String