htmllib, formatter

Terry Hancock hancock at
Tue Aug 6 23:11:54 CEST 2002

From: Milos Prudek <milos.prudek at>
> I'd like to make an almost verbatim copy of a html file. The only change 
> would be in a SRC tag of <IMG SRC>. Is htmllib suitable for this?
> In, there's DumbWriter, which removes all HTML markup, but 
> there is no "VerbatimWriter" which would keep all HTML as it is.
> My html file may contain a lot of advanced HTML 4.0 markup. Since 
> htmllib supports only HTML 2.0, how difficult it would be to create 
> "VerbatimWriter"? I feel I would have to create "start_table", 
> "start_tr", "start_td", "start_script", and a lot of other procedures.
> This looks like an overkill if the aim is a simple modification of IMG 
> SRC. Correct?

In your shoes, I would forget about the fact that it's
HTML, and just use the re module to do a regular
expression substitution.  Probably much simpler, I visualize
3-5 lines of code for that.


Terry Hancock
hancock at       
Anansi Spaceworks         
P.O. Box 60583                     
Pasadena, CA 91116-6583

More information about the Python-list mailing list