[Tutor] printing columns

Richard Chamberlain richard_chamberlain@ntlworld.com
Fri, 21 Jul 2000 07:28:15 +0100


Hi Ben,

Why not use:

print "%6s %6s %6s" %(thelist[item1],thelist[item2],thelist[item3])

Richard
----- Original Message ----- 
From: Ben Beuchler <insyte@emt-p.org>
To: <tutor@python.org>
Sent: Thursday, July 20, 2000 11:29 PM
Subject: [Tutor] printing columns


> I have a list of around 650 or so items.  I would like to be able to
> print them in columns, three across, like so:
> 
> item1 item2 item3
> item4 item5 item6
> item7 item8 item9
> 
> Any suggestions on a clean way to accomplish this?  The items will be of
> varying width, so just adding tabs won't reliably format them.
> 
> Thanks,
> Ben
> 
> -- 
> Ben Beuchler                                         insyte@bitstream.net
> MAILER-DAEMON                                         (612)-321-9290 x101
> Bitstream Underground                                   www.bitstream.net
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://www.python.org/mailman/listinfo/tutor