本文整理匯總了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