has anyone implemented perl's HTML::Element and related modules for python?

Jack Diederich jack at performancedrivers.com
Sat May 31 09:55:57 EDT 2003


On Sat, May 31, 2003 at 12:30:43PM +0000, Tom Bryan wrote:
> William Clifford wrote:
> 
> > I ask because I was just starting to use them when I got curious about
> > this python thing.
> 
> >From a quick look at CPAN, it looks like that's a way to represent an HTML 
> doc as a collection of objects...probably  using some sort of Composite 
> Pattern.  If that's what you're talking about, I think that  HTMLgen is 
> probably similar
> http://starship.python.net/crew/friedrich/HTMLgen/html/main.html

Less of a DOM but maybe what you are looking for is HyperText
http://dustman.net/andy/python/HyperText/

It is used like
  from HTML import *
  A(IMG(border = 0, src = 'images/off.gif'), href = 'off.html')

Fairly simple, I don't do anything complicated w/ HTML so I like it.
It also throws a fit if attributes aren't in the HTML4.0 spec (which most
of the time means you made a typo).

-jackdied





More information about the Python-list mailing list