Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41600
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Subject | Re: join() |
| Date | 2013-03-20 14:44 +0000 |
| References | <6110d82b-fce9-4146-8fcc-3276334a8f5f@14g2000vbr.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3566.1363790630.2939.python-list@python.org> (permalink) |
On 20/03/2013 14:05, franzferdinand wrote: > I'm doing this "Write code that removes whitespace at the beginning > and end of a string, and normalizes whitespace between words to be a > single space character" > > I can do it using split() > >>>> raw = " the weather is sunny today " >>>> raw.split() > ['the', 'weather', 'is', 'sunny', 'today'] > > But how do I do it using join() ?? Thanks > ' '.join(raw.split()) -- Cheers. Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
join() franzferdinand <melo.dumoulin@hotmail.com> - 2013-03-20 07:05 -0700
Re: join() Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2013-03-20 14:34 +0000
Re: join() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-20 14:39 +0000
Re: join() Tim Chase <python.list@tim.thechases.com> - 2013-03-20 10:54 -0500
Re: join() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-20 18:44 +0000
Re: join() Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-20 14:44 +0000
Re: join() franzferdinand <melo.dumoulin@hotmail.com> - 2013-03-20 07:46 -0700
csiph-web