0

So, i am using Humanize in Python and Nextcord for a discord bot to shorten my Numbers with many zeros in a json file. When i am humanizing it with following code:

import humanize

def humanizing(num):
    num = humanize.intword(num)
    num = num.replace(".0", "")
    return num



@client.command()
async def account(ctx, player: nextcord.Member = None):
    if player is None:
        player = ctx.author
    await open_account(player)
    await check(player)
    user = player
    users = await get_bank_data()
    wallet_amt = users[str(user.id)]["Wallet"]
    print(humanizing(wallet_amt))
{
    "593456006160318464": {
        "Wallet": 1000000000000000000000000000000000000,
        "Bank": 0,
        "Bounty": 0,
        "Username": "Navis"
    }
}

and the user has 1000000000000000000000000000000000000 money, it says 0 googol instead of 1 googol. Adding more Zeroes will cause a failure and say then like 10000 decillion

Does Humanize just break at this point or is it because of me? These Code snippets are the important stuff for the problem. If you need more of my code tell me!

Navis
  • 77
  • 5
  • 1
    Looks like a googol is [as far as it goes](https://github.com/python-humanize/humanize/blob/c730de51911214a6f2b90f4e6bce2312eb081aa1/src/humanize/number.py#L177). – snakecharmerb Dec 31 '22 at 17:06
  • @snakecharmerb so its just normal that it breaks at 0 googol and goes further to decillion? – Navis Dec 31 '22 at 17:08
  • It seems that numbers that large aren't really supported yet. I'd suggest opening an issue at https://github.com/python-humanize/humanize/issues – DenverCoder1 Jan 02 '23 at 23:53

0 Answers0