SyntaxFix
Write A Post
Hire A Developer
Questions
You can use the strip() to remove trailing and leading spaces.
>>> s = ' abd cde ' >>> s.strip() 'abd cde'
Note: the internal spaces are preserved