Print a big integer with punctions with Python3 string formating mini-language
Question: I want a point after each three digits in a big number (e.g. `4.100.200.300`).

    
    
    >>> x = 4100200300
    >>> print('{}'.format(x))
    4100200300
    

This question is specific to Pythons string formating mini-language.


Answer: There's only one available thousands separator.

> The `','` option signals the use of a comma for a thousands separator.

([docs](https://docs.python.org/3/library/string.html#format-specification-
mini-language))

Example:

    
    
    '{:,}'.format(x) # 4,100,200,300
    

If you need to use a dot as a thousand separator, consider replacing commas
with `'.'` or setting the locale (_LC_NUMERIC_ category) appropriately.

You could use [this](http://lh.2xlibre.net/values/thousands_sep/) list to find
the right locale. Note that you'll have to use the `n` integer presentation
type for locale-aware formatting:

    
    
    import locale
    locale.setlocale(locale.LC_NUMERIC, 'de_DE') # or da_DK, or lt_LT, or mn_MN, or ...
    '{:n}'.format(x) # 4.100.200.300
    

In my opinion, the former approach is much simpler:

    
    
    '{:,}'.format(x).replace(',', '.') # 4.100.200.300
    

or

    
    
    format(x, ',').replace(',', '.') # 4.100.200.300
    

