本文整理汇总了Python中HTMLParser.HTMLParser.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python HTMLParser.__init__方法的具体用法?Python HTMLParser.__init__怎么用?Python HTMLParser.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLParser.HTMLParser
的用法示例。
在下文中一共展示了HTMLParser.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def __init__(self, *args, **kwargs):
'''
__init__ - Create an AdvancedTagSlim object.
@see AdvancedTag
Extra arguments:
slimSelfClosing <bool> default False - If True, will use slim-endings on self-closing tags,
i.e. <br/> instead of <br />
This may break xhtml compatibility but modern browsers are okay with it.
'''
if 'slimSelfClosing' in kwargs:
slimSelfClosing = kwargs.pop('slimSelfClosing')
else:
slimSelfClosing = False
AdvancedTag.__init__(self, *args, **kwargs)
object.__setattr__(self, 'slimSelfClosing', slimSelfClosing)
示例2: __init__
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def __init__(self):
HTMLParser.__init__(self)
self.messageId = None
self.messageTime = None
self.messageUser = None
self.messageText = None
self.messages = []
self.reserves24change = None
self.reservesALFAcashier = None
self.usersOnline = None
self.botsOnline = None
self.inMessageA = False
self.inMessageSpan = False
self.in24changeSpan = False
self.inALFAcashierSpan = False
self.inUsersOnlineDiv = False
self.devOnline = False
self.supportOnline = False
self.adminOnline = False
示例3: __init__
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def __init__(self, data):
"""
The data holds the characters.
Example:
html = Html()
data = '<body><em>alpha</em></body>'
dom = html.feed(data)
x = dom.fst('em')
x.append(Data('\nbeta'))
It outputs.
<body ><em >alpha
beta</em></body>
"""
Root.__init__(self, DATA)
self.data = data
示例4: __init__
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def __init__(self, error, command, returnstatus, stdout=None, stderr=None):
"""Initialize this instance.
Args:
error: Error message.
command: Command that failed.
returnstatus: Status of the command that failed.
stdout: Standard output stream of the failed command.
stderr: Standard error stream of the failed command.
"""
super(CommandError, self).__init__(error)
self.command = command
self.returnstatus = returnstatus
self.stdout = stdout
self.stderr = stderr
self.error = error
示例5: __init__
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def __init__(self, callback_found_name, callback_found_fb_id):
HTMLParser.__init__(self)
self.callback_found_name = callback_found_name
self.callback_found_fb_id = callback_found_fb_id
self.tag_level_a = 0
self.tag_level_a_target = None
示例6: __init__
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def __init__(self):
HTMLParser.__init__(self)
self.__spell_check_res = {}
self.__grammar_check_res = None
self.__ignore_tag = False
self.__is_code_block = False
self.__in_code_block = False
self.__dictionary = enchant.DictWithPWL('en_US', 'web-data/mxnet/doc/ignored_words.txt')
self.__spell_checker = SpellChecker(self.__dictionary)
self.__parsed_content = ""
self.__grammar_checker = grammar_check.LanguageTool('en-US')
示例7: __init__
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def __init__(self):
HTMLParser.__init__(self)
示例8: __init__
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def __init__(self):
self.tokens = []
HTMLParser.__init__(self)
示例9: get_links
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def get_links(html):
class URLSeeker(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.urls = []
def handle_starttag(self, tag, attrs):
href = dict(attrs).get('href')
if href and tag == 'a':
self.urls.append(href)
url_seeker = URLSeeker()
url_seeker.feed(html)
return url_seeker.urls
示例10: __init__
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def __init__(self, base_url, concurrency=10):
self.q = queues.Queue()
self.q2 = queues.Queue()
self.start = time.time()
self.fetching = set()
self.fetched = set()
self.base_url = base_url
self.concurrency = concurrency
self.i = 0
示例11: get_links
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def get_links(self, html):
class URLSeeker(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.urls = []
def handle_starttag(self, tag, attrs):
href = dict(attrs).get('href')
if href and tag == 'a':
self.urls.append(href)
url_seeker = URLSeeker()
url_seeker.feed(html)
return url_seeker.urls
示例12: get_links
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def get_links(html):#解析HTML
class URLSeeker(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.urls = []
def handle_starttag(self, tag, attrs):
href = dict(attrs).get('href')
if href and tag == 'a':
self.urls.append(href)
url_seeker = URLSeeker()
url_seeker.feed(html)
return url_seeker.urls
示例13: __init__
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def __init__(self, processfn):
HTMLParser.__init__(self)
self.in_par = False
self.processfn = processfn
示例14: __init__
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def __init__(self, v, typ=None):
self.type = typ
self.value = v.strip("\n\r\t ")
示例15: __init__
# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def __init__(self, encoding='latin-1'):
HTMLParser.__init__(self)
self._reset()
self.encoding = encoding