On Tue, Sep 1, 2009 at 7:46 AM, Sander Sweers <[email protected]>wrote:

> 2009/9/1 Luke Paireepinart <[email protected]>:
> >>>> txt = "Hi          how are you?"
> >>>> " ".join(txt.strip().split())
> > 'Hi how are you?'
>
> txt.strip() only remove leading and trailing white space so does
> nothing in your example.

It removes newlines as well.
I couldn't remember if split() would leave the trailing newline on the last
item.
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to