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
Release history Release notifications | RSS feed
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)
Built Distribution
numify-1.0.1-py3-none-any.whl
(4.0 kB
view hashes)