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


Python CleanText.clean方法代码示例

本文整理汇总了Python中weboob.browser.filters.standard.CleanText.clean方法的典型用法代码示例。如果您正苦于以下问题:Python CleanText.clean方法的具体用法?Python CleanText.clean怎么用?Python CleanText.clean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在weboob.browser.filters.standard.CleanText的用法示例。


在下文中一共展示了CleanText.clean方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: filter

# 需要导入模块: from weboob.browser.filters.standard import CleanText [as 别名]
# 或者: from weboob.browser.filters.standard.CleanText import clean [as 别名]
 def filter(self, el):
     index = 1 if len(el) > 1 else 0
     content = CleanText.clean(CleanText('.', ['HORAIRES'])(el[index]))
     a_time = content.split(' - ')[0]
     regexp = re.compile(ur'(?P<hh>\d+)h?(?P<mm>\d+)')
     m = regexp.search(a_time)
     return time(int(m.groupdict()['hh'] or 0), int(m.groupdict()['mm'] or 0))
开发者ID:Konubinix,项目名称:weboob,代码行数:9,代码来源:pages.py

示例2: filter

# 需要导入模块: from weboob.browser.filters.standard import CleanText [as 别名]
# 或者: from weboob.browser.filters.standard.CleanText import clean [as 别名]
    def filter(self, el):
        index = 1 if len(el) > 1 else 0
        content = CleanText.clean(CleanText('.', ['HORAIRES'])(el[index]))
        a_price = content.split(' - ')[-1]
        parsed_price = re.findall(r"\d*\,\d+|\d+", " ".join(a_price))

        if parsed_price and len(parsed_price) > 0:
            return float(parsed_price[0].replace(',', '.'))

        return float(0)
开发者ID:P4ncake,项目名称:weboob,代码行数:12,代码来源:pages.py

示例3: next_page

# 需要导入模块: from weboob.browser.filters.standard import CleanText [as 别名]
# 或者: from weboob.browser.filters.standard.CleanText import clean [as 别名]
    def next_page(self):
        try:
            form = self.page.get_form('//form[@id="paginationForm"]')
        except FormNotFound:
            return

        text = CleanText.clean(form.el)
        m = re.search(u'(\d+) / (\d+)', text or '', flags=re.MULTILINE)
        if not m:
            return

        cur = int(m.group(1))
        last = int(m.group(2))

        if cur == last:
            return

        form['page'] = str(cur + 1)
        return form.request
开发者ID:nojhan,项目名称:weboob-devel,代码行数:21,代码来源:pages.py

示例4: get_list

# 需要导入模块: from weboob.browser.filters.standard import CleanText [as 别名]
# 或者: from weboob.browser.filters.standard.CleanText import clean [as 别名]
    def get_list(self):
        account = None

        for cpt in self.document.xpath('//a[@class="synthese_id_compte" or @class="synthese_carte_differe"]'):
            url_to_parse = cpt.xpath('@href')[0].replace("\n", "")  # link
            # account._link_id = lien vers historique d'un compte (courant ou livret)
            if '/mes-comptes/livret/' in url_to_parse:
                compte_id_re = re.compile(r'.*\?(.*)$')
                link_id = '/fr/prive/mes-comptes/livret/consulter-situation/consulter-solde.jsp?%s' % \
                    (compte_id_re.search(url_to_parse).groups()[0])
            else:
                link_id = url_to_parse

            number = cpt.xpath('./span[@class="synthese_numero_compte"]')
            if len(number) == 0:
                account._card_links.append(link_id)
                continue

            account = Account()
            account.id = self.parser.tocleanstring(number[0]).replace(u'N°', '')

            try:
                balance = self.parser.tocleanstring(cpt.xpath('./span[contains(@class, "synthese_solde")]')[0])
            except IndexError:
                continue

            account.balance = Decimal(Transaction.clean_amount(balance))
            account.currency = account.get_currency(balance)
            account._link_id = link_id
            account._card_links = []
            account.label = (' '.join([CleanText.clean(part) for part in cpt.xpath('./text()')])).strip(' - ').strip()

            for pattern, type in self.ACCOUNT_TYPES.iteritems():
                if pattern in account._link_id:
                    account.type = type

            yield account
开发者ID:dasimon,项目名称:weboob,代码行数:39,代码来源:accounts_list.py


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