當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。