
Oct. 18, 2011
2:05 a.m.
On Mon, Oct 17, 2011 at 7:57 PM, Christopher King <g.nius.ck@gmail.com> wrote: ..
reduce(operator.concat,(x.strip() for x in xs))
To long for something so simple
.. and how would tuple comprehensions help in this case? A shorter expression would be
''.join(x.strip() for x in xs)
For your data, .strip() seems redundant, so
''.join(xs)
would achieve the same result. Finally, a more realistic application would want to separate the data somehow:
','.join(xs)