strip text of spaces python code example
Example 1: python delete white spaces
sentence = ' hello apple'
sentence.strip()
>>> 'hello apple'
Example 2: remove extra spaces python
>>> import re
>>> re.sub(' +', ' ', 'The quick brown fox')
'The quick brown fox'