Ezio Melotti added the comment:
> this inconsistent cannot be fixed from the inherited class as (handle_*
> calls are dispatched in the internal method of HTMLParser)
You can override handle_startendtag() like this:
>>> class MyHTMLParser(HTMLParser):
... def handle_starttag(self, tag, attrs):
... print('start', tag)
... def handle_endtag(self, tag):
... print('end', tag)
... def handle_startendtag(self, tag, attrs):
... self.handle_starttag(tag, attrs)
...
>>> parser = MyHTMLParser()
>>> parser.feed('<link rel="import"/><img src="som"/>')
start link
start img
(P.S. please don't quote the whole message in your reply)
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue25258>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com