Answers for "best way to remove all whitespace python"

3

remove extra spaces python

>>> import re
>>> re.sub(' +', ' ', 'The     quick brown    fox')
'The quick brown fox'
Posted by: Guest on July-14-2020
4

trimming spaces in string python

a = "      yo!      "
b = a.strip() # this will remove the white spaces that are leading and trailing
Posted by: Guest on June-20-2020

Code answers related to "best way to remove all whitespace python"

Python Answers by Framework

Browse Popular Code Answers by Language