Gabriel Genellina <[EMAIL PROTECTED]> wrote:
>py> text = 'This          is some \t   text with  multiple\n\n  spaces.'
>py> import re
>py> re.sub(r'\s+', ' ', text)
>'This is some text with multiple spaces.'

py> ' '.join(text.split())
'This is some text with multiple spaces.'

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
   "Frankly I have no feelings towards penguins one way or the other"
        -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to