millify icon indicating copy to clipboard operation
millify copied to clipboard

Convert long numbers into a human-readable format in Python

Results 12 millify issues
Sort by recently updated
recently updated
newest added

prettify was only using the custom separator once, then all latter separators defaulted to comma. reproducible with long numbers, e.g. prettify(1000000000, "-") -> '1,000,000-000'

The code in this PR is build on top of @weefatboi's work (#2). `tests\test_millify.py` now contains unit tests that test the fix by @weefatboi, and the existing code. Based on...

# What bug does this PR fix? - There's a bug where iterations of three 9s (`999`, `999999`, `999999999`, etc) should round up to the next `millname` (`999999` should become...

Using 999999 with millify should return 1M but it returns 1000k ``` >>> from millify import millify >>> millify('999999') >>> '1000k' ```

Sometimes you want a fixed number of characters to be used for a number (for logging for example). With 5 characters (this includes numbers, decimal points and magnitude): 4000000 =>...

The function prettify has a self-loop, but it doesn't account for a different character in the loop it just affects the first iteration. This is the solution to the error....

Could you make a reversed version of your library? One that converts shortened prefixes to their longer number counterparts. That would be amazing. Thanks for the project as well.

Notice issued in public interest - The library hasn't been updated from 7 years because it doesn't need to be updated - This library just works!