0

I have the following code:

from babel.numbers import format_currency
print(format_currency(100000, currency="GBP", locale="en_GB"))

And the output is:

£100,000.00

Whereas I want the output to be:

£100,000

I have checked the documentation for Babel: https://babel.pocoo.org/en/latest/api/numbers.html and can see no way to do this.

Any advice on how to achieve my goal?

Thanks in advance.

Raju Ahmed
  • 1,282
  • 5
  • 15
  • 24
Nicholas
  • 3,517
  • 13
  • 47
  • 86

1 Answers1

0

If anyone has a way to do it in babel, that would be helpful, however I can use string formatting instead:

currency = "£{:,.0f}".format(100000)

output: '£100,000'

Nicholas
  • 3,517
  • 13
  • 47
  • 86