all Python 3localefunction
locale.localeconv()
locale setup
Returns a dictionary of the current locale's conventions: decimal point, thousands separator, grouping and currency symbol.
Syntax
locale.localeconv()
The dictionary is a snapshot taken at call time: request it again after setlocale(). In the 'C' locale (in force until something calls setlocale) thousands_sep is empty and grouping is [], so grouping=True in format_string() groups nothing there. Monetary fields such as p_cs_precedes equal CHAR_MAX (127) in 'C', meaning 'unspecified', not a number.
Examples
import locale
conv = locale.localeconv()
print(conv['decimal_point'], conv['thousands_sep'] == '', conv['grouping']) # → . True []
print(conv['p_cs_precedes'] == locale.CHAR_MAX) # → True
See also
Open in the full glossarydocs.python.orgReport an inaccuracy