Python module to format text into columns?
hamish_lawson at yahoo.co.uk
hamish_lawson at yahoo.co.uk
Tue Nov 16 05:44:51 EST 1999
mlh at vier.idi.ntnu.no (Magnus L. Hetland) wrote:
> Without really knowing whether there is such a module, I offer a
> simple implementation of some of the functionality, which can easily
> be extended:
Holding to the principle of not reinventing the wheel, I decided to
search the Python archives and (if necessary) ask in this newsgroup
before attempting to write my own module. Now that it appears that no
such module already exists, your contribution, Magnus, has given me a
start in writing my own. Thank you.
The module could provide a format picture mechanism for specifying
column widths and alignments:
formatter.setpicture(" <<<<<<<<<<<<<<<< <<<< >>>>>>")
but I'm inclined to provide (at least initially) just the direct
methods:
formatter.setcolumn(column=1, margin=4, width=16, align=left)
formatter.setcolumn(column=2, margin=2, width=4, align=left)
formatter.setcolumn(column=3, margin=2, width=6, align=right)
Does anyone have any thoughts on this?
Hamish Lawson
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list