Line breaks in list causing a small formatting problem while joining the list
Oltmans
rolf.oltmans at gmail.com
Fri Jan 21 10:39:26 EST 2011
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.
More information about the Python-list
mailing list