so how do *you* generate XHTML?

Jacob Smullyan smulloni at
Sat Jan 18 04:30:00 CET 2003

In article <slrnb26aej.1hr.nthomas at>, N. Thomas wrote:
> I've got some data that I'd like Python to spit out into XHTML, and I
> don't want to print out raw XHTML strings, ala (print '<title>%s</title>
> % body['title']).
> After looking around a bit, the only module I can find that can do this
> is HTMLgen, which was exactly what I was looking for. The only problem
> is that HTMLgen is about 4 or 5 years old, and AFAIK, hasn't been
> developed further since then.

> My question: Is there a newer version of HTMLgen or is there a newer
> tool that does the same thing as HTMLgen?

If  all you want to do is produce xhtml elements through a simple api,
reminiscent of Apache's ECS or, you can use ecs, which is in
SkunkWeb CVS:

You use it like so:

tr=ecs.Tr(ecs.Td(ecs.A('click here').setAttribute('href', '')))
print ecs.Html(ecs.Body(ecs.Table(tr)))

The ecs elements are modifiable, so you can pass them around and
subject them to operations if you like.  Sometimes it is just neater
to use these little objects rather than html strings; sometimes there
is just no point to doing so, however!


More information about the Python-list mailing list