Convert float to comma-separated string
python
Solution
You can use the `locale.format()` function to do this:
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'en_US.utf8')
'en_US.utf8'
>>> locale.format("%.2f", 100028282.23, grouping=True)
'100,028,282.23'
Note that you have to give the precision: `%.2f`
Alternatively you can use the `locale.currency()` function, which follow the `LC_MONETARY` settings:
>>> locale.currency(100028282.23)
'$100028282.23'
Problem
How would I convert a float into its 'accounting form' -- ``` 100028282.23 --> 100,028,282.23 100028282 --> 100,028,282.00 ``` Is there a python method that does this?