the god of human readable numbers
pip install khnum
𓎹𓃝
import khnum
>>> 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",
"line": "1.2GB (1,234,567,890)",
"type": "<class 'int'>",
"units": "b"
}
$ pydoc khnum
>>> help(khnum)
$ pytest
@siznax