Re: whitespace within a string

From: Erik Max Francis (max_at_alcyone.com)
Date: 02/24/04


Date: Mon, 23 Feb 2004 20:47:51 -0800

Bart Nessux wrote:

> Is there a function/module that can be used to throw out extra
> whitespace
> that appears within a string? The problem that I have is this: Before
> any
> configuration is done to my files, they have lines with tabs in
> between the
> words like this:
>
> "disable = yes"

If you realy want to collapse any whitespace at all into a single space
character, how about:

        ' '.join(S.split())

-- 
 __ Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
/  \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ One sword keeps the other in the sheath.
    -- George Herbert


Relevant Pages