Source Code:
(back to article)
string_with_whitespace = " This string has leading whitespace. " trimmed_string = string_with_whitespace.lstrip() print(trimmed_string) # Output: "This string has leading whitespace. " string_with_whitespace = " This string has trailing whitespace. " trimmed_string = string_with_whitespace.rstrip() print(trimmed_string) # Output: " This string has trailing whitespace."
Result:
Report an issue