当前位置: 首页>>代码示例>>Python>>正文


Python HTMLParser.__init__方法代码示例

本文整理汇总了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) 
开发者ID:kata198,项目名称:AdvancedHTMLParser,代码行数:23,代码来源:Formatter.py

示例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 
开发者ID:ericjang,项目名称:cryptocurrency_arbitrage,代码行数:23,代码来源:scraping.py

示例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 
开发者ID:elgatito,项目名称:script.elementum.burst,代码行数:22,代码来源:ehp.py

示例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 
开发者ID:google,项目名称:fplutil,代码行数:18,代码来源:build_perf.py

示例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 
开发者ID:internaut,项目名称:facebook-discussion-tk,代码行数:8,代码来源:fb_parser.py

示例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') 
开发者ID:awslabs,项目名称:dynamic-training-with-apache-mxnet-on-aws,代码行数:13,代码来源:doc_spell_checker.py

示例7: __init__

# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def __init__(self):
        HTMLParser.__init__(self) 
开发者ID:graalvm,项目名称:mx,代码行数:4,代码来源:mx_mxtests.py

示例8: __init__

# 需要导入模块: from HTMLParser import HTMLParser [as 别名]
# 或者: from HTMLParser.HTMLParser import __init__ [as 别名]
def __init__(self):
        self.tokens = []
        HTMLParser.__init__(self) 
开发者ID:the-louie,项目名称:sectoralarm,代码行数:5,代码来源:HTML.py

示例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 
开发者ID:tao12345666333,项目名称:tornado-zh,代码行数:16,代码来源:webspider.py

示例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 
开发者ID:makelove,项目名称:Python_Master_Courses,代码行数:11,代码来源:tornado-crawler-demo2.py

示例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 
开发者ID:makelove,项目名称:Python_Master_Courses,代码行数:16,代码来源:tornado-crawler-demo2.py

示例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 
开发者ID:makelove,项目名称:Python_Master_Courses,代码行数:16,代码来源:tornado-crawler-demo1.py

示例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 
开发者ID:gooofy,项目名称:zamia-speech,代码行数:8,代码来源:parole.py

示例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 ") 
开发者ID:manatlan,项目名称:vbuild,代码行数:5,代码来源:__init__.py

示例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 
开发者ID:textclf,项目名称:fancy-cnn,代码行数:6,代码来源:parser.py


注:本文中的HTMLParser.HTMLParser.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。