Best way to clean up list items?
Stephen Hansen
me+python at ixokai.io
Mon May 2 13:25:30 EDT 2016
On Mon, May 2, 2016, at 09:33 AM, DFS wrote:
> Have: list1 = ['\r\n Item 1 ',' Item 2 ','\r\n ']
I'm curious how you got to this point, it seems like you can solve the
problem in how this is generated.
> Want: list1 = ['Item 1','Item 2']
That said:
list1 = [t.strip() for t in list1 if t and not t.isspace()]
--
Stephen Hansen
m e @ i x o k a i . i o
More information about the Python-list
mailing list