python string trim

There are three functions to remove spaces in the string,
strip removes the spaces on the left and right sides at the same time
lstrip removes the space on the left
rstrip removes the space on the right

>>>a=" gho stwwl "
>>>a.lstrip()
'gho stwwl '
>>> a.rstrip()
'gho stwwl'
>>>a.strip()
'gho stwwl'


Related: python string trim