how to generate html table from "table" data?

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Wed Dec 26 03:28:13 EST 2007


petr.jakes.tpc at gmail.com a écrit :
> Hi group,
> I would like to convert the output of the SQL query, or more generally
> I would like to convert any "table" data to the html table.

There's MoreThanOneWayToDoIt... from simple string formatting to a 
full-blown template engine.

> I would like to set some rules to format cells, columns or rows (font,
> colour etc.) of the html table, according to the values in the
> specific cells.

<ot>
Markup should only convey semantic informations - presentation is best 
done using css. IOW : presentation-related stuff in the html should be 
restricted to css class declarations.
</ot>

> Googling for a while I have found only this tool:
> http://pasko.net/PyHtmlTable/
> 
> Your tips to some other tools or/and your suggestion how to solve
> above mentioned will be very helpful.

As I said, wrt/ html generation, there are quite a lot of possible 
solutions - FWIW, generating an html table from a set of tabular data is 
nothing difficult. So without more information on the context, it's hard 
to give any valuable advice. Are you doing a web application ? If yes, 
you should already use a template engine, so just use it. Else, why is 
your application generating html at all ?



More information about the Python-list mailing list