Oltmans wrote: > Hi Python gurus, hope you're doing well. I've a small problem. > > When I run the following code > ___________________________________________________ >>>> names = ['oltmans','abramhovic','\n','sal','lee'] >>>> print '| ' + ' | '.join(names) > | oltmans | abramhovic | > | sal | lee > ___________________________________________________ > > I get the output like above. However, I want it to output like below > > | oltmans | abramhovic | > | sal | lee > > > That is, there shouldn't be a space in the beginning of second line. > The list can of course contain more than 5 elements. Any ideas? I will > appreciate any hint. Thanks in advance.
>>> print "|%s|" % "|".join(n if n == "\n" else " %s " % n for n in names) | oltmans | abramhovic | | sal | lee | -- http://mail.python.org/mailman/listinfo/python-list