Stripping whitespace

James Matthews nytrokiss at gmail.com
Wed Jan 23 14:10:46 EST 2008


Using the split method is the easiest!

On 23 Jan 2008 19:04:38 GMT, Marc 'BlackJack' Rintsch <bj_666 at gmx.net> wrote:
> On Wed, 23 Jan 2008 10:50:02 -0800, ryan k wrote:
>
> > Hello. I have a string like 'LNAME
> > PASTA               ZONE'. I want to create a list of those words and
> > basically replace all the whitespace between them with one space so i
> > could just do lala.split(). Thank you!
>
> You *can* just do ``lala.split()``:
>
> In [97]: lala = 'LNAME           PASTA               ZONE'
>
> In [98]: lala.split()
> Out[98]: ['LNAME', 'PASTA', 'ZONE']
>
> Ciao,
>         Marc 'BlackJack' Rintsch
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://search.goldwatches.com/?Search=Movado+Watches
http://www.jewelerslounge.com
http://www.goldwatches.com



More information about the Python-list mailing list