xml.etree.ElementTree.XMLParser has no attribute '_parser' in python-3.x -
trying run code in python-3.x not work works fine in 2.7. looking in c:\python34\lib\xml\etree\elementtree.py see python3 imports c implementation of elementtree while python2 not. how can solve this? forcing elementtree not import c implementation.
from xml.etree import elementtree xml.etree.elementtree import xmlparser class customxmlparser(xmlparser): def __init__(self, html=0, target=none, encoding=none): xmlparser.__init__(self, html, target, encoding) self._parser.commenthandler = self.handle_comments def handle_comments(self): pass tree = elementtree.parse(path, customxmlparser())
i have tried elementtree.xmltreebuilder works in python2.
thanks!
Comments
Post a Comment