ExpatError.code
Expat’s internal error number for the specific error. The errors.messages
dictionary maps these error numbers to Expat’s error messages. For example:
1 2 3 4 5 6 7 | from xml.parsers.expat import ParserCreate, ExpatError, errors p = ParserCreate() try : p.Parse(some_xml_document) except ExpatError as err: print( "Error:" , errors.messages[err.code]) |
The errors
module also provides error message constants and a dictionary codes
mapping these messages back to the error codes, see below.
Please login to continue.