[Tutor] Need to be taught a trick or two about printing in neat columns
rabidpoobear at gmail.com
Thu Nov 2 10:45:23 CET 2006
Instead of helping you with your specific problem, I'll give you this
information and see what you can make of it.
>>> print 'a'.ljust(20)+'b'.ljust(20)
>>> print 'carrah'.ljust(20)+'foobar'.ljust(20)
Notice how they're all lined up on the left (if the font in this e-mail
is fixed-width. Either way, the number of spaces for both columns is
ljust's functionality is essentially this:
x = len(astr)
while x < width:
astr += ' '
x += 1
More information about the Tutor