本文整理汇总了Python中html.parser方法的典型用法代码示例。如果您正苦于以下问题:Python html.parser方法的具体用法?Python html.parser怎么用?Python html.parser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类html
的用法示例。
在下文中一共展示了html.parser方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_html_import
# 需要导入模块: import html [as 别名]
# 或者: from html import parser [as 别名]
def test_html_import(self):
import html
import html.entities
import html.parser
self.assertTrue(True)
示例2: test_with_deleted_parent
# 需要导入模块: import html [as 别名]
# 或者: from html import parser [as 别名]
def test_with_deleted_parent(self):
# see #18681
from html import parser
html = sys.modules.pop('html')
def cleanup():
sys.modules['html'] = html
self.addCleanup(cleanup)
with self.assertRaisesRegex(ImportError, 'html'):
imp.reload(parser)
示例3: simple_parse_to_segments
# 需要导入模块: import html [as 别名]
# 或者: from html import parser [as 别名]
def simple_parse_to_segments(html, debug=False, **kwargs):
html = fix_urls(html)
html = '<html>' + html + '</html>' # html.parser seems to ignore the final entityref without html closure
parser = simpleHTMLParser(debug)
return parser.feed(html)
示例4: test_future_moves
# 需要导入模块: import html [as 别名]
# 或者: from html import parser [as 别名]
def test_future_moves(self):
"""
Ensure everything is available from the future.moves interface that we
claim and expect. (Issue #104).
"""
from future.moves.collections import Counter, OrderedDict # backported to Py2.6
from future.moves.collections import UserDict, UserList, UserString
from future.moves import configparser
from future.moves import copyreg
from future.moves.itertools import filterfalse, zip_longest
from future.moves import html
import future.moves.html.entities
import future.moves.html.parser
from future.moves import http
import future.moves.http.client
import future.moves.http.cookies
import future.moves.http.cookiejar
import future.moves.http.server
from future.moves import queue
from future.moves import socketserver
from future.moves.subprocess import check_output # even on Py2.6
from future.moves.subprocess import getoutput, getstatusoutput
from future.moves.sys import intern
from future.moves import urllib
import future.moves.urllib.error
import future.moves.urllib.parse
import future.moves.urllib.request
import future.moves.urllib.response
import future.moves.urllib.robotparser
try:
# Is _winreg available on Py2? If so, ensure future.moves._winreg is available too:
import _winreg
except ImportError:
pass
else:
from future.moves import winreg
from future.moves import xmlrpc
import future.moves.xmlrpc.client
import future.moves.xmlrpc.server
from future.moves import _dummy_thread
from future.moves import _markupbase
from future.moves import _thread