You can use the strip()
method to remove trailing and leading spaces:
>>> s=" abd cde "
>>> s.strip()
'abd cde'
Note: the internal spaces are preserved.
You can use the strip()
method to remove trailing and leading spaces:
>>> s=" abd cde "
>>> s.strip()
'abd cde'
Note: the internal spaces are preserved.