python delete space after last split code example
Example 1: replacing spaces in a string python
mystring.replace(" ", "_")
Example 2: python trim whitespace from end of string
>>> " xyz ".rstrip()
' xyz'
mystring.replace(" ", "_")
>>> " xyz ".rstrip()
' xyz'