I have a number with 1 decimal point such as 123456.1
i would like to format it to 123,456.1
Tried to use locale to format the number but was unable to get it to work
Instead I used the following:
def format(n):
r = []
for i, c in enumerate(reversed(str(n))):
if i and (not (i % 3)):
r.insert(0, ',')
r.insert(0, c)
return ''.join(r)
which results in 1,234,56.1