1 Sep 2009 14:46
Re: Easy Problem
Sander Sweers <sander.sweers <at> gmail.com>
2009-09-01 12:46:33 GMT
2009-09-01 12:46:33 GMT
2009/9/1 Luke Paireepinart <rabidpoobear <at> gmail.com>: >>>> 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. However it works because txt.split() removes the excessive white space between the text. >>> txt 'Hi how are you?' >>> ' '.join(txt.split()) 'Hi how are you?' Greets Sander _______________________________________________ Tutor maillist - Tutor <at> python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
RSS Feed