locale.nl_langinfo(option)
Return some locale-specific information as a string. This function is not available on all systems, and the set of possible options might also vary across platforms. The possible argument values are numbers, for which symbolic constants are available in the locale module.
The nl_langinfo()
function accepts one of the following keys. Most descriptions are taken from the corresponding description in the GNU C library.
-
locale.CODESET
-
Get a string with the name of the character encoding used in the selected locale.
-
locale.D_T_FMT
-
Get a string that can be used as a format string for
time.strftime()
to represent date and time in a locale-specific way.
-
locale.D_FMT
-
Get a string that can be used as a format string for
time.strftime()
to represent a date in a locale-specific way.
-
locale.T_FMT
-
Get a string that can be used as a format string for
time.strftime()
to represent a time in a locale-specific way.
-
locale.T_FMT_AMPM
-
Get a format string for
time.strftime()
to represent time in the am/pm format.
-
DAY_1 ... DAY_7
-
Get the name of the n-th day of the week.
Note
This follows the US convention of
DAY_1
being Sunday, not the international convention (ISO 8601) that Monday is the first day of the week.
-
ABDAY_1 ... ABDAY_7
-
Get the abbreviated name of the n-th day of the week.
-
MON_1 ... MON_12
-
Get the name of the n-th month.
-
ABMON_1 ... ABMON_12
-
Get the abbreviated name of the n-th month.
-
locale.RADIXCHAR
-
Get the radix character (decimal dot, decimal comma, etc.).
-
locale.THOUSEP
-
Get the separator character for thousands (groups of three digits).
-
locale.YESEXPR
-
Get a regular expression that can be used with the regex function to recognize a positive response to a yes/no question.
Note
The expression is in the syntax suitable for the
regex()
function from the C library, which might differ from the syntax used inre
.
-
locale.NOEXPR
-
Get a regular expression that can be used with the regex(3) function to recognize a negative response to a yes/no question.
-
locale.CRNCYSTR
-
Get the currency symbol, preceded by “-” if the symbol should appear before the value, “+” if the symbol should appear after the value, or ”.” if the symbol should replace the radix character.
-
locale.ERA
-
Get a string that represents the era used in the current locale.
Most locales do not define this value. An example of a locale which does define this value is the Japanese one. In Japan, the traditional representation of dates includes the name of the era corresponding to the then-emperor’s reign.
Normally it should not be necessary to use this value directly. Specifying the
E
modifier in their format strings causes thetime.strftime()
function to use this information. The format of the returned string is not specified, and therefore you should not assume knowledge of it on different systems.
-
locale.ERA_D_T_FMT
-
Get a format string for
time.strftime()
to represent date and time in a locale-specific era-based way.
-
locale.ERA_D_FMT
-
Get a format string for
time.strftime()
to represent a date in a locale-specific era-based way.
-
locale.ERA_T_FMT
-
Get a format string for
time.strftime()
to represent a time in a locale-specific era-based way.
-
locale.ALT_DIGITS
-
Get a representation of up to 100 values used to represent the values 0 to 99.
Please login to continue.