HTML/text formatting question

Dr. Who google at spiceaid.com
Wed Aug 3 11:33:22 EDT 2005


I have a tool that outputs data in either html or text output.

Currently I'm writing chucnks like:

if html:
    print '<html><body bgcolor="FFFFCC">'
    print '<table border="1" bgcolor="CCCCFF" width="800">'
    print '<tr><td colspan="2"><h2>'
print 'Differences %s: %s' % (htypestr, lbl1)
if html:
	...

This seems clunky and my next step was going to be to define generic
functions which would generate the surrounding html tags only when
passed the proper argument.  I was wondering if there was a better way
to do this with a standard Python library.  It looked like formatter
might but that it also might be too low-level.

Any help is appreciated,
Jeff




More information about the Python-list mailing list