Python Long Numbers comme chaîne

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]}"
Benja