This question has been asked before, but the fast answers that I have seen also remove the trailing spaces, which I don't want.
" a bc "
should become
" a bc "
I have
text = re.sub(' +', " ", text)
but am hoping for something faster. The suggestion that I have seen (and which won't work) is
' '.join(text.split())
Note that I will be doing this to lots of smaller texts so just checking for a trailing space won't be so great.