lxml.etree.parser()和lxml.etree.fromstring()的默认解析器是什么

时间:2018-12-09 16:57:55

标签: python lxml

help(etree.fromstring)开始,如果没有将parser参数传递给该函数,则使用默认的解析器。

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等)创建的解析器?

0 个答案:

没有答案