Human Readable
Project description
Features
File size humanization.
List humanization.
Requirements
It works in Python 3.7+.
Installation
You can install Human Readable via pip from PyPI:
$ pip install human-readable
Usage
Import the lib with:
import human_readable
File size humanization:
human_readable.file_size(1000000)
"1.0 MB"
human_readable.file_size(1000000, binary=True)
"976.6 KiB"
human_readable.file_size(1000000, gnu=True)
"976.6K"
Lists humanization:
human_readable.listing(["Alpha", "Bravo"], ",")
"Alpha, Bravo"
human_readable.listing(["Alpha", "Bravo", "Charlie"], ";", "or")
"Alpha; Bravo or Charlie"
Numbers humanization:
human_readable.int_comma(12345)
"12,345"
human_readable.int_word(123455913)
"123.5 million"
human_readable.int_word(12345591313)
"12.3 billion"
human_readable.ap_number(4)
"four"
human_readable.ap_number(41)
"41"
Floating point number humanization:
human_readable.fractional(1.5)
"1 1/2"
human_readable.fractional(0.3)
"3/10"
Scientific notation:
human_readable.scientific_notation(1000)
"1.00 x 10³"
human_readable.scientific_notation(5781651000, precision=4)
"5.7817 x 10⁹"
Click here for more examples and detailed usage.
Contributing
Contributions are very welcome. To learn more, see the Contributor Guide.
License
Distributed under the terms of the MIT license, Human Readable is free and open source software.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Credits
This lib is based on original humanize with some added features such as listing, improved naming, documentation, some more testing, bug fixes and better Portuguese support.
This project was generated from @cjolowicz’s Hypermodern Python Cookiecutter template.
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
Built Distribution
Hashes for human_readable-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 165d6d7164e133adf0db6a3bcf101eceb7b7de5a066d286880d7fe633e186de2 |
|
MD5 | 69fb2f53858c7a24d4d9f294e80c7d12 |
|
BLAKE2b-256 | 35d903d35a7328bcff5804f5e2de9306bd35060970c8971b4dbefaa17da23ae3 |