Stripping whitespace

ryan k ryan at ryankaskel.com
Wed Jan 23 14:12:44 EST 2008


On Jan 23, 2:04 pm, Marc 'BlackJack' Rintsch <bj_... 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()``:

Indeed you can thanks!

>
> In [97]: lala = 'LNAME           PASTA               ZONE'
>
> In [98]: lala.split()
> Out[98]: ['LNAME', 'PASTA', 'ZONE']
>
> Ciao,
>         Marc 'BlackJack' Rintsch




More information about the Python-list mailing list