Which method can be used to remove any whitespace from both the beginning and the end of a string code example
Example 1: python delete white spaces
sentence = ' hello apple'
sentence.strip()
>>> 'hello apple'
Example 2: Which method in an be used to remove any whitespace from both the beginning and the end of a string?
str = "hello "
print(str.trim())
Example 3: python trim whitespace from end of string
>>> " xyz ".rstrip()
' xyz'