Removing whitespace

Moshe Zadka moshez at math.huji.ac.il
Mon Jul 31 06:50:30 EDT 2000


On Mon, 31 Jul 2000 pauljolly at my-deja.com wrote:

> Dear All,
> 
> Firstly, apologies for all the questions! However, extensive searching
> and reading of manuals has not helped me here. How does one remove
> whitespace characters from a string (using the re module)? 

I don't understand what you're doing here: trim whitespace off the ends?

string.strip(s)

Take out all whitespace?

string.join(string.split(s), '')

Or 

string.replace(s, ' ', '')

(Which is the same thing)
--
Moshe Zadka <moshez at math.huji.ac.il>
There is no IGLU cabal.
http://advogato.org/person/moshez





More information about the Python-list mailing list