python convert long floats to usd

Solutions on MaxInterview for python convert long floats to usd by the best coders in the world

showing results for - "python convert long floats to usd"
Stella
20 Oct 2019
1>>> '${:,.2f}'.format(1234.5)
2'$1,234.50'
3
Riccardo
30 Sep 2016
1def as_currency(amount):
2    if amount >= 0:
3        return '${:,.2f}'.format(amount)
4    else:
5        return '-${:,.2f}'.format(-amount)
6
similar questions
queries leading to this page
python convert long floats to usd