Using Babel I get this:
>>> babel.numbers.format_currency(1099.98, 'CHF', locale='fr_CH')
'1\u202f099,98\xa0CHF'
I would like this format:
"CHF 1'099.98"
Is it possible to specify a custom format with babel?
My current ugly workaround is:
>>> num = 1099.998
>>> s = f"CHF {num:,.2f}".replace(',',"'")
>>> s
"CHF 1'100.00"
But it also round my number :(
The simpliest solution is to change the locale from fr_CH to de_CH. This seems to be the currency formatting locale you require.
It can also be achieved using PyICU:
Where as the French (Switzerland) locale gives:
and