[Tutor] Displaying in columnar / tabular form

wesley chun wescpy at gmail.com
Thu Aug 24 20:05:09 CEST 2006


On 8/24/06, Kent Johnson <kent37 at tds.net> wrote:
> Vincent Gulinao wrote:
> >
> > Anyone knows a neat way of displaying output in columnar/tabular form?
>
> You might like this recipe:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/267662
>
> Another option is to write an HTML file containing a table.


the recipe that kent suggested seems really fully-featured.  for
simpler applications where i just want "to do it myself," i would use
the same string methods that the recipe's code uses: center(),
ljust(), and rjust().

another alternative for external columnar alighment, in addition to
kent's HTML suggestion is to just write it directly into an Excel
spreadsheet (via Win32 libraries) or alternatively, generate a CSV
file that Excel can import.

hope this helps!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com


More information about the Tutor mailing list