>>> " xyz ".rstrip()
' xyz'
Use the strip() method
Example
>>> name = ' Steve '
>>> name
' Steve '
>>> name = name.strip()
>>> name
'Steve'
Use the rstrip() method
Example
>>> name = ' Steve '
>>> name
' Steve '
>>> name = name.rstrip()
>>> name
' Steve'
Use the lstrip() method
>>> name = ' Steve '
>>> name
' Steve '
>>> name = name.lstrip()
>>> name
'Steve '