[Tutor] Generating simple HTML from within Python

Alan Gauld alan.gauld at btinternet.com
Thu May 10 23:03:52 CEST 2007

"Duncan Gibson" <duncan at thermal.esa.int> wrote

> I've been searching for a module to allow simple HTML generation, 
> but
> most of them appear to be more concerned with *parsing* HTML and 
> XML.
> The only one that looks promising from reviews dating back to 1998 
> or
> so is HTMLgen, but the link on starship.python.net appears long 
> dead.

HTMLgen is OK but you might be better off looking at one of the
templating tookits like Cheetah or Kid. Kid is fine for XHTML but I
believe Cheetah is more flexible if you want non XML compliant
HTML etc too. However I can only speak for Kid in the context
of TurboGears...

And if its not overly complex simple python string formatting
might be all you need with the HTML inside a triple quoted
string with formatting markers as needed.

But a proper templating system will cope with repeating elements
like tables much better.

Alan G. 

More information about the Tutor mailing list