On Sunday, January 2, 2011 5:43:38 PM UTC, gervaz wrote: > Sorry, but it does not work > > >>> def prg3(l): > ... return "\n".join([x for x in l if x]) > ... > >>> prg3(t) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "<stdin>", line 2, in prg3 > TypeError: sequence item 0: expected str instance, Test found
def prg3(l): return '\n'.join([str(x) for x in l if x]) That should do it -- http://mail.python.org/mailman/listinfo/python-list