Python locale Functions

EditRocket provides the following information on locale functions in the Python source code builder.

atof(string) - Converts a string to a floating point number, following the LC_NUMERIC settings.

atoi(string) - Converts a string to an integer, following the LC_NUMERIC conventions.

currency(val[, symbol[, grouping[, international]]]) - Formats a number val according to the current LC_MONETARY settings.

format(format, val[, grouping[, monetary]]) - Formats a number val according to the current LC_NUMERIC setting.

format_string(format, val[, grouping]) - Processes formatting specifiers as in format % val, but takes the current locale settings into account.

getdefaultlocale([envvars]) - Tries to determine the default locale settings and returns them as a tuple of the form (language code, encoding).

getlocale([category]) - Returns the current setting for the given locale category as sequence containing language code, encoding.

getpreferredencoding([do_setlocale]) - Return the encoding used for text data, according to user preferences.

localeconv() - Returns the database of the local conventions as a dictionary.

nl_langinfo(option) -

resetlocale([category]) - Sets the locale for category to the default setting.

setlocale(category[, locale]) - If locale is specified, it may be a string, a tuple of the form (language code, encoding), or None.

str(float) - Formats a floating point number using the same format as the built-in function str(float), but takes the decimal point into account.

strcoll(string1, string2) - Compares two strings according to the current LC_COLLATE setting.

strxfrm(string) - Transforms a string to one that can be used for the built-in function cmp()