[Tutor] Printing a formatted list (of lists)

Allyn Weaks allyn.@tardigrade.net
Mon, 29 Jul 2002 02:29:42 -0700


Python 2.n on unix.

I have a table that's a list of lists (values can be mixed
numbers/text).  Is there a clean way to print a formatted list?  What I
have works, but it seems that there ought to be a more list-oriented
way of formatting the list part.  Or is this one of those places where
one accepts the explicit loop?  I've tried out list comprehension
variations 'til I'm dizzy with nothing but assorted errors.

for j in range(len(table)):
    print `table[j]`.rjust(columnwidth),

Thanks!
-- 
Allyn Weaks    allyn@tardigrade.net   Seattle, WA  Sunset zone 5
Pacific NW Native Wildlife Gardening: http://www.tardigrade.org/natives/
"The benefit of even limited monopolies is too doubtful, to be opposed
to that of their general suppression."  Thomas Jefferson