File tree Expand file tree Collapse file tree
bs4__BeautifulSoup__examples Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ # -*- coding: utf-8 -*-
3+
4+ __author__ = 'ipetrash'
5+
6+
7+ # pip install lxml
8+ # pip install html5lib
9+ # pip install bs4
10+
11+ from bs4 import BeautifulSoup
12+
13+
14+ text = "<xml/>"
15+
16+ root = BeautifulSoup (text , 'html.parser' )
17+ print (root .builder ) # bs4.builder._htmlparser.HTMLParserTreeBuilder
18+
19+ root = BeautifulSoup (text , 'html5lib' )
20+ print (root .builder ) # bs4.builder._html5lib.HTML5TreeBuilder
21+
22+ root = BeautifulSoup (text , 'xml' )
23+ print (root .builder ) # bs4.builder._lxml.LXMLTreeBuilderForXML
24+
25+ root = BeautifulSoup (text , 'lxml-xml' )
26+ print (root .builder ) # bs4.builder._lxml.LXMLTreeBuilderForXML
27+
28+ root = BeautifulSoup (text , 'lxml' )
29+ print (root .builder ) # bs4.builder._lxml.LXMLTreeBuilder
30+
31+ root = BeautifulSoup (text , 'lxml-html' )
32+ print (root .builder ) # bs4.builder._lxml.LXMLTreeBuilder
You can’t perform that action at this time.
0 commit comments