On Mar 10, 3:42 pm, John Machin <[EMAIL PROTECTED]> wrote rather baroquely: > ...>>> def myfunc(s, spaces): > > ... return '\n'.join(spaces + x.rstrip() if x.rstrip() else '' for > x in s.splitlines())
Better: ... return '\n'.join((spaces + x).rstrip() for x in s.splitlines()) -- http://mail.python.org/mailman/listinfo/python-list