trimming white space at the end of string python code example
Example 1: python trim whitespace from end of string
>>> " xyz ".rstrip()
' xyz'
Example 2: how to strip white space of text in python?
sentence = ' hello apple'
" ".join(sentence.split())
>>> 'hello apple'