Stripping whitespace
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Wed Jan 23 14:04:38 EST 2008
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
More information about the Python-list
mailing list