Re: Whitespace test after string.split

2005-11-26 Thread Bengt Richter
On Sat, 26 Nov 2005 16:15:17 +0100, Peter Otten <[EMAIL PROTECTED]> wrote: >David Pratt wrote: > >> Hi. I am splitting a string on a non whitespace character. One or more >> whitespace characters can be returned as items in the list. I do not >> want the items in the list that are only whitespace

Re: Whitespace test after string.split

2005-11-26 Thread David Pratt
Hi Fredrik. Good to know. Many thanks for your replies. Regards David On Saturday, November 26, 2005, at 12:27 PM, Fredrik Lundh wrote: > David Pratt wrote: > >> Also thanks for heads up for changes with method. I am >> still using 2.3 but will move to 2.4 as soon as this is formally >> approv

Re: Whitespace test after string.split

2005-11-26 Thread Fredrik Lundh
David Pratt wrote: > Also thanks for heads up for changes with method. I am > still using 2.3 but will move to 2.4 as soon as this is formally > approved for use in Zope. note that the string.split function has been "outdated" since Python 1.6 (released in 2000), and despite what the documentati

Re: Whitespace test after string.split

2005-11-26 Thread David Pratt
Hi Fredrik and Peter. Many thanks for this helpful advice :-) These are very nice solutions and much better than what I had been contemplating. Also thanks for heads up for changes with method. I am still using 2.3 but will move to 2.4 as soon as this is formally approved for use in Zope. Re

Re: Whitespace test after string.split

2005-11-26 Thread Fredrik Lundh
Peter Otten wrote: [t.strip() for t in s.split(",") if t and not t.isspace()] > ['alpha', 'gamma', 'delta'] footnote: this solution is faster than my filter version. -- http://mail.python.org/mailman/listinfo/python-list

Re: Whitespace test after string.split

2005-11-26 Thread Fredrik Lundh
David Pratt wrote: > Hi. I am splitting a string on a non whitespace character. One or more > whitespace characters can be returned as items in the list. I do not > want the items in the list that are only whitespace (can be one or more > characters of whitespace) and plan to use string.strip on

Re: Whitespace test after string.split

2005-11-26 Thread Peter Otten
David Pratt wrote: > Hi. I am splitting a string on a non whitespace character. One or more > whitespace characters can be returned as items in the list. I do not > want the items in the list that are only whitespace (can be one or more > characters of whitespace) and plan to use string.strip on