Skip to main content

Human readable numbers

Project description

khnum 𓎹𓃝

Khnum image

the god of human readable numbers

Install

pip install khnum
𓎹𓃝

Usage

import khnum

Examples

>>> khnum.cnum(1234567890)
'1,234,567,890'
>>> khnum.hnum(1234567890)
'1.2B'
>>> khnum.hnum(1234567890, 'bytes')
'1.2GB'
>>> khnum.hnum(1234567890, 'si')
'1.1GiB'
>>> num = khnum.num(1234567890, 'b')
>>> print(num)
{
    "_num": 1234567890,
    "cnum": "1,234,567,890",
    "hnum": "1.2GB",
    "type": "<class 'int'>",
    "units": "b"
}

Help

$ pydoc khnum
>>> help(khnum)

Test

$ pytest

Contributors

@siznax

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

khnum-0.0.3.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

khnum-0.0.3-py3-none-any.whl (4.1 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