"Tim" <[EMAIL PROTECTED]> wrote
> after reading the responses to athread in 2004 [1] I am wondering
> why there is
> no easy function in python to remove all white spaces from a string.
>
> " i am very fine "
> to
> "iamveryfine"
You can use string.replace.
>>> 'I am very fine'.replace(' ','')
'Iamveryfine'
>>>
But you need to apply several times if you want more than simple
spaces removed.
Or you can use regexs. (Or the translate function might work too, but
i haven't
tried it for this)
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor