Limit humanize output to 2 decimal places

kivy_mainline_and_py3.8
Tyler Goodlet 2018-02-14 02:43:55 -05:00
parent e464898210
commit 722b515246
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ def humanize(number):
if mag < 3:
return number
maxmag = max(itertools.takewhile(lambda key: mag >= key, mag2suffix))
return "{:.3f}{}".format(number/10**maxmag, mag2suffix[maxmag])
return "{:.2f}{}".format(number/10**maxmag, mag2suffix[maxmag])
def percent_change(init, new):