locale.getdefaultlocale
Prev: locale.format_string | Up: locale | Next: locale.getencoding
Rel: locale.atof, locale.atoi, locale.currency, locale.Error
Ref: docs.python.org — locale.getdefaultlocale
Tags: #public #python3 #stdlib #locale
Import
import locale
from locale import getdefaultlocale
Signature & Overview
locale.getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE'))
Tries to determine the default locale settings and returns them as tuple (language code, encoding).
Usage
import locale
# Deprecated (removed in Python 3.15): prefer locale.getlocale() or locale.getencoding()
assert callable(locale.getlocale)
Gotchas
- Deprecated: Use
locale.getlocale()orlocale.getencoding()instead.
REPL Inspect
from locale import getdefaultlocale
help(getdefaultlocale)
Linked from
Related notes
- tuts/python3/stdlib_module/locale/format_string Linked here; links to this page; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/getencoding Linked here; links to this page; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/locale/atof Linked here; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/atoi Linked here; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/currency Linked here; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/Error Linked here; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/getlocale shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/getpreferredencoding shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/localeconv shared tags: #locale, #stdlib