Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python long numbers as string

import math

def human_format(number):
    units = ['', 'K', 'M', 'G', 'T', 'P']
    k = 1000.0
    magnitude = int(math.floor(math.log(abs(number), k)))
    return f"{number/k**magnitude:.2f}{units[magnitude]}"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #long #numbers #string
ADD COMMENT
Topic
Name
5+4 =