Python lxml.etree.parser()和lxml.etree.fromstring()的默认解析器是什么
从Python lxml.etree.parser()和lxml.etree.fromstring()的默认解析器是什么,python,lxml,Python,Lxml,从帮助(etree.fromstring)中,如果没有解析器参数传递给函数,则使用默认解析器 fromstring(text, parser=None, *, base_url=None) fromstring(text, parser=None, base_url=None) Parses an XML document or fragment from a string. Returns the root node (or the result returned
帮助(etree.fromstring)
中,如果没有解析器
参数传递给函数,则使用默认解析器
fromstring(text, parser=None, *, base_url=None)
fromstring(text, parser=None, base_url=None)
Parses an XML document or fragment from a string. Returns the
root node (or the result returned by a parser target).
To override the default parser with a different parser you can pass it to
the ``parser`` keyword argument.
The ``base_url`` keyword argument allows to set the original base URL of
the document to support relative Paths when looking up external entities
(DTD, XInclude, ...).
那么默认的解析器是什么呢?
XMLParser()
实例,或与传入的数据类型(html、xml等)对应创建的解析器?有一个函数。它返回lxml.etree.XMLParser
的实例。你为什么这么问?@mzjn该死。我错过了。我注意到lxml文档中的API中有set\u default\u parser()
。但我忘了把它挖得更深。谢谢。