"<!" in SGMLParser - an error ?

Fredrik Lundh fredrik at pythonware.com
Wed Nov 7 12:14:45 EST 2001


Amit Weisman wrote:
> I wasn't clear enougth .
> I know one should declare functions as
> def do_TAGNAME
> def start_TAGNAME
> def end_TAGNAME
>
> How do I declare function for the "<!. ... " tag ?
>
> Python wouldn't accept def start_! ......

in addition the do/start/end methods, sgmllib lets you
define general handlers for stuff like entities, comments,
etc.  to deal with things that start with "<!", you want

    def handle_comment(self, comment)

or

    def handle_decl(self, data)

(see the library reference for more info)

</F>

<!-- (the eff-bot guide to) the python standard library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->





More information about the Python-list mailing list