Name
handle_charref
Synopsis
s
.handle_charref(ref
)
Called to process a character reference
'&#
ref
;
‘.
SGMLParser
’s implementation of
handle_charref
handles decimal numbers in
range(0,256)
, like:
def handle_charref(self, ref): try: c = chr(int(ref)) except (TypeError, ValueError): self.unknown_charref(ref) else: self.handle_data(c)
Your subclass X
may override
handle_charref
or
unknown_charref
in order to support other forms of
character references '&#...;
‘.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.