python trim white space in string code example
Example 1: python delete white spaces
sentence = ' hello apple'
sentence.strip()
>>> 'hello apple'
Example 2: python trim whitespace from end of string
>>> " xyz ".rstrip()
' xyz'
sentence = ' hello apple'
sentence.strip()
>>> 'hello apple'
>>> " xyz ".rstrip()
' xyz'