There is only one thousands separator available.
The ',' option signals the use of a comma for the thousands separator.
( docs )
Example:
'{:,}'.format(x)
If you need to use a period as a thousands separator, consider replacing commas with '.' or set the locale (category LC_NUMERIC) accordingly.
You can use this list to find the correct language. Note that you will need to use the n integer view type for local formatting:
import locale locale.setlocale(locale.LC_NUMERIC, 'de_DE')
In my opinion, the previous approach is much simpler:
'{:,}'.format(x).replace(',', '.')
or
format(x, ',').replace(',', '.')
source share