Generating HTML from python

Thomas Guettler guettli at
Thu Jun 9 16:33:33 CEST 2005

Am Thu, 09 Jun 2005 12:43:19 +0000 schrieb Philippe C. Martin:

> Hi,
> I wish to use an easy way to generate reports from wxPython and feel
> wxHtmlEasyPrinting could be a good solution.
> I now need to generate the HTML wxHtmlEasyPrinting can print

I don't know wxPython, but generating HTML is very easy.

Some people say mixing HTML and programming code is not good.

But if you want to create dynamic pages with more logic than HTML
this is the best solution.

Example: Multiplication Table

for i in range(1, 11):
    heading.append('<th bgcolor="grey">%s</th>' % i)
    for j in range(1, 11):
        cols.append('<td align="right">%s</td>' % (i*j))
    row='<tr><th bgcolor="grey">%s</th>%s</tr>' % (i, ''.join(cols))
  <head><title>Multiplication Table</title></head>
   <table border="1">
     <th> </th> %s
 </html> """ % (''.join(heading), ''.join(rows))

I guess this looks more ugly in most template languages.


Thomas Güttler,

More information about the Python-list mailing list