Re: whitespace within a string
From: Erik Max Francis (max_at_alcyone.com)
Date: 02/24/04
- Next message: Josiah Carlson: "Re: How do I access Python's dictionary of all global variables?"
- Previous message: Christian Tismer: "Re: [Stackless] Re: Stackless 3.0 for Python 2.3: new binaries"
- In reply to: Bart Nessux: "whitespace within a string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Josiah Carlson: "Re: How do I access Python's dictionary of all global variables?"
- Previous message: Christian Tismer: "Re: [Stackless] Re: Stackless 3.0 for Python 2.3: new binaries"
- In reply to: Bart Nessux: "whitespace within a string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|