Suppose this string:
The fox jumped over the log.
Turning into:
This also seems to work:
while " " in s: s = s.replace(" ", " ")
Where the variable s represents your string.
s