The Indian number systems uses lakhs (lacs) and crores. How do I format numbers with thousand separators as Indian style? 1000 I want to display as 1,000 and so on to 1,00,000:
Number | Format as |
---|---|
10 | 10 |
100 | 100 |
1000 | 1,000 |
10000 | 10,000 |
100000 | 1,00,000 |
1000000 | 10,00,000 |
10000000 | 1,00,00,000 |
100000000 | 10,00,00,000 |
1000000000 | 1,00,00,00,000 |
10000000000 | 10,00,00,00,000 |
I want to do this in python.
I recognize this way of separating numbers as the one used in India. So I think you can get what you want using locale
:
import locale
locale.setlocale(locale.LC_NUMERIC, 'hi_IN')
locale.format_string("%d", 10000000000, grouping=True)
The exact locale to use may be different on your system; try locale -a | grep IN
to get a list of Indian locales you have installed.