當前位置: 首頁>>代碼示例>>Python>>正文


Python EntitySubstitution.substitute_html方法代碼示例

本文整理匯總了Python中bs4.dammit.EntitySubstitution.substitute_html方法的典型用法代碼示例。如果您正苦於以下問題:Python EntitySubstitution.substitute_html方法的具體用法?Python EntitySubstitution.substitute_html怎麽用?Python EntitySubstitution.substitute_html使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bs4.dammit.EntitySubstitution的用法示例。


在下文中一共展示了EntitySubstitution.substitute_html方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: substitute_html

# 需要導入模塊: from bs4.dammit import EntitySubstitution [as 別名]
# 或者: from bs4.dammit.EntitySubstitution import substitute_html [as 別名]
def substitute_html(cls, ns):
        return cls._substitute_if_appropriate(
            ns, EntitySubstitution.substitute_html) 
開發者ID:MarcelloLins,項目名稱:ServerlessCrawler-VancouverRealState,代碼行數:5,代碼來源:element.py

示例2: __init__

# 需要導入模塊: from bs4.dammit import EntitySubstitution [as 別名]
# 或者: from bs4.dammit.EntitySubstitution import substitute_html [as 別名]
def __init__(
            self, language=None, entity_substitution=None,
            void_element_close_prefix='/', cdata_containing_tags=None,
    ):
        """Constructor.

        :param language: This should be Formatter.XML if you are formatting
           XML markup and Formatter.HTML if you are formatting HTML markup.

        :param entity_substitution: A function to call to replace special
           characters with XML/HTML entities. For examples, see 
           bs4.dammit.EntitySubstitution.substitute_html and substitute_xml.
        :param void_element_close_prefix: By default, void elements
           are represented as <tag/> (XML rules) rather than <tag>
           (HTML rules). To get <tag>, pass in the empty string.
        :param cdata_containing_tags: The list of tags that are defined
           as containing CDATA in this dialect. For example, in HTML,
           <script> and <style> tags are defined as containing CDATA,
           and their contents should not be formatted.
        """
        self.language = language
        self.entity_substitution = entity_substitution
        self.void_element_close_prefix = void_element_close_prefix
        self.cdata_containing_tags = self._default(
            language, cdata_containing_tags, 'cdata_containing_tags'
        ) 
開發者ID:V1EngineeringInc,項目名稱:V1EngineeringInc-Docs,代碼行數:28,代碼來源:formatter.py


注:本文中的bs4.dammit.EntitySubstitution.substitute_html方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。