On this page
locale.getlocale
Prev: locale.getencoding | Up: locale | Next: locale.getpreferredencoding
Rel: locale.atof, locale.atoi, locale.currency, locale.Error
Ref: docs.python.org — locale.getlocale
Tags: #public #python3 #stdlib #locale
Import
import locale
from locale import getlocale
Signature & Overview
locale.getlocale(category=2)
Returns the current setting for the given locale category as tuple (language code, encoding).
Usage
import locale
lang, enc = locale.getlocale()
assert lang is None or isinstance(lang, str)
Gotchas
- Returns
(None, None)in the default"C"locale.
REPL Inspect
from locale import getlocale
help(getlocale)
Linked from
Related notes
- tuts/python3/stdlib_module/locale/getencoding Linked here; links to this page; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/getpreferredencoding 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/format_string shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/getdefaultlocale shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/localeconv shared tags: #locale, #stdlib