Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(35)  |  Call(35)  |  Derive(0)  |  Import(0)
Parse localized number string into an integer.

>>> parse_number('1,099', locale='en_US')
1099
>>> parse_number('1.099', locale='de_DE')
1099

When the given string cannot be parsed, an exception is raised:

>>> parse_number('1.099,98', locale='de')(more...)

        def parse_number(string, locale=LC_NUMERIC):
    """Parse localized number string into an integer.

    >>> parse_number('1,099', locale='en_US')
    1099
    >>> parse_number('1.099', locale='de_DE')
    1099

    When the given string cannot be parsed, an exception is raised:

    >>> parse_number('1.099,98', locale='de')
    Traceback (most recent call last):
        ...
    NumberFormatError: '1.099,98' is not a valid number

    :param string: the string to parse
    :param locale: the `Locale` object or locale identifier
    :return: the parsed number
    :raise `NumberFormatError`: if the string can not be converted to a number
    """
    try:
        return int(string.replace(get_group_symbol(locale), ''))
    except ValueError:
        raise NumberFormatError('%r is not a valid number' % string)
        


src/w/e/webapp2_example-HEAD/lib/webapp2_extras/i18n.py   webapp2_example(Download)
            number.
        """
        return numbers.parse_number(string, locale=self.locale)
 
    def parse_decimal(self, string):

src/k/a/KalaPy-0.4.2/kalapy/i18n/format.py   KalaPy(Download)
def parse_number(string):
    """Parse a localized number string into a long integer.
    """
    return numbers.parse_number(string, locale=get_locale())
 
    sep = numbers.get_decimal_symbol(locale)
    num, decimals = string.rsplit(sep, 1)
    num = numbers.parse_number(num, locale=locale)
    string = '%s.%s' % (num, decimals)
    return Decimal(string) if force_decimal else float(string)

src/k/a/kalapy-HEAD/kalapy/i18n/format.py   kalapy(Download)
def parse_number(string):
    """Parse a localized number string into a long integer.
    """
    return numbers.parse_number(string, locale=get_locale())
 
    sep = numbers.get_decimal_symbol(locale)
    num, decimals = string.rsplit(sep, 1)
    num = numbers.parse_number(num, locale=locale)
    string = '%s.%s' % (num, decimals)
    return Decimal(string) if force_decimal else float(string)

src/a/p/appscale-HEAD/AppServer/lib/webapp2-2.5.2/webapp2_extras/i18n.py   appscale(Download)
            number.
        """
        return numbers.parse_number(string, locale=self.locale)
 
    def parse_decimal(self, string):

src/a/p/appscale-HEAD/AppServer/lib/webapp2-2.5.1/webapp2_extras/i18n.py   appscale(Download)
            number.
        """
        return numbers.parse_number(string, locale=self.locale)
 
    def parse_decimal(self, string):

src/a/p/appscale-HEAD/AppServer/lib/webapp2-2.3/webapp2_extras/i18n.py   appscale(Download)
            number.
        """
        return numbers.parse_number(string, locale=self.locale)
 
    def parse_decimal(self, string):

src/g/o/google-app-engine-HEAD/lib/webapp2-2.5.2/webapp2_extras/i18n.py   google-app-engine(Download)
            number.
        """
        return numbers.parse_number(string, locale=self.locale)
 
    def parse_decimal(self, string):

src/g/o/google-app-engine-HEAD/lib/webapp2-2.5.1/webapp2_extras/i18n.py   google-app-engine(Download)
            number.
        """
        return numbers.parse_number(string, locale=self.locale)
 
    def parse_decimal(self, string):

src/g/o/google-app-engine-HEAD/lib/webapp2-2.3/webapp2_extras/i18n.py   google-app-engine(Download)
            number.
        """
        return numbers.parse_number(string, locale=self.locale)
 
    def parse_decimal(self, string):

src/g/o/googleappengine-python-HEAD/lib/webapp2-2.5.2/webapp2_extras/i18n.py   googleappengine-python(Download)
            number.
        """
        return numbers.parse_number(string, locale=self.locale)
 
    def parse_decimal(self, string):

  1 | 2 | 3  Next