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


Python builder.HTML5TreeBuilder方法代碼示例

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


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

示例1: default_builder

# 需要導入模塊: from bs4 import builder [as 別名]
# 或者: from bs4.builder import HTML5TreeBuilder [as 別名]
def default_builder(self):
        return HTML5TreeBuilder() 
開發者ID:MarcelloLins,項目名稱:ServerlessCrawler-VancouverRealState,代碼行數:4,代碼來源:test_html5lib.py

示例2: test_combination

# 需要導入模塊: from bs4 import builder [as 別名]
# 或者: from bs4.builder import HTML5TreeBuilder [as 別名]
def test_combination(self):
        if LXML_PRESENT:
            self.assertEqual(registry.lookup('fast', 'html'),
                             LXMLTreeBuilder)

        if LXML_PRESENT:
            self.assertEqual(registry.lookup('permissive', 'xml'),
                             LXMLTreeBuilderForXML)
        self.assertEqual(registry.lookup('strict', 'html'),
                          HTMLParserTreeBuilder)
        if HTML5LIB_PRESENT:
            self.assertEqual(registry.lookup('html5lib', 'html'),
                              HTML5TreeBuilder) 
開發者ID:MarcelloLins,項目名稱:ServerlessCrawler-VancouverRealState,代碼行數:15,代碼來源:test_builder_registry.py

示例3: test_lookup_by_markup_type

# 需要導入模塊: from bs4 import builder [as 別名]
# 或者: from bs4.builder import HTML5TreeBuilder [as 別名]
def test_lookup_by_markup_type(self):
        if LXML_PRESENT:
            self.assertEqual(registry.lookup('html'), LXMLTreeBuilder)
            self.assertEqual(registry.lookup('xml'), LXMLTreeBuilderForXML)
        else:
            self.assertEqual(registry.lookup('xml'), None)
            if HTML5LIB_PRESENT:
                self.assertEqual(registry.lookup('html'), HTML5TreeBuilder)
            else:
                self.assertEqual(registry.lookup('html'), HTMLParserTreeBuilder) 
開發者ID:MarcelloLins,項目名稱:ServerlessCrawler-VancouverRealState,代碼行數:12,代碼來源:test_builder_registry.py

示例4: test_named_library

# 需要導入模塊: from bs4 import builder [as 別名]
# 或者: from bs4.builder import HTML5TreeBuilder [as 別名]
def test_named_library(self):
        if LXML_PRESENT:
            self.assertEqual(registry.lookup('lxml', 'xml'),
                             LXMLTreeBuilderForXML)
            self.assertEqual(registry.lookup('lxml', 'html'),
                             LXMLTreeBuilder)
        if HTML5LIB_PRESENT:
            self.assertEqual(registry.lookup('html5lib'),
                              HTML5TreeBuilder)

        self.assertEqual(registry.lookup('html.parser'),
                          HTMLParserTreeBuilder) 
開發者ID:MarcelloLins,項目名稱:ServerlessCrawler-VancouverRealState,代碼行數:14,代碼來源:test_builder_registry.py


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