I use locale.format()
to separate numbers into commas, but that function doesn't get rid of scientific notation. I want a way to return a number separated into commas, with trailed zeros and no scientific notation.
Example of actual code: 1160250.1294254328
-> 1.16025e+06
Example of I want: 1160250.1294254328
-> 1,160,250.13
My code:
locale.setlocale(locale.LC_ALL, 'en_US.utf8')
x = 1160250.1294254328
x = round(x, 2)
x = locale.format("%g", x, grouping=True, monetary=True)