Skip to main content

Convert alphanumeric characters to integers i.e 1k to 1000

Project description

Numify

Numify is a Python (2 and 3) library for converting alphanumeric characters into integers.

Numify is the opposite of Numerize (another python library, that can be found here).

Installation

You can install the Numify from PyPI:

$ pip install numify

The library is supported on Python 2.7, as well as Python 3.4 and above.

How to use

numify(alphanumeric_to_numify)

>>> from numify import numify
>>> numify.numify('12K')
12000
>>> numify.numify('15   k')
15000

This will convert the alphanumeric string '15 k' into an integer like 15000 (ignoring the spaces between).

Example

Command Output
numify("1K") 1000
numify("1k") 1000
numify("1 K") 1000
numify("1.5K) 1500
numify("1M) 1000000
numify("1.5m) 1500000
numify("1B) 1000000000
numify("1.5b) 1500000000
numify("1T) 1000000000000

Testing

$ python numify/numify_test.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

numify-1.0.1.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

numify-1.0.1-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page