whitespace within a string
Erik Max Francis
max at alcyone.com
Mon Feb 23 23:47:51 EST 2004
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 at 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
More information about the Python-list
mailing list