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

Currently I'm writing chucks 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
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to