string python strip whitespace code example
Example 1: python trim whitespace from end of string
>>> " xyz ".rstrip()
' xyz'
Example 2: python string remove whitespace
' sss d ssd s'.replace(" ", "")
# output: 'sssdssds'
>>> " xyz ".rstrip()
' xyz'
' sss d ssd s'.replace(" ", "")
# output: 'sssdssds'