Formatting large integers in Python
-
28-09-2019 - |
Pergunta
I am dealing with large integral numbers in my script and I want to format the numbers into strings using the 'K'
, 'M'
and 'B'
postfix chars to denote scale of thousands, millions or billionsб respectively.
Rather than rolling my own function, I wonder if there is an built-in function that either does this "out of the box", or at least would be useful when writing my own function to do this type of formatting?
Solução
There's no built-in way to do this in the Python standard library, but there's a nice example of what you want to achieve here.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow