Suppose this string:
The fox jumped over the log.
Turning into:
>>> import re >>> re.sub(' +', ' ', 'The quick brown fox') 'The quick brown fox'