On this page
locale.normalize
Prev: locale.localeconv | Up: locale | Next: locale.setlocale
Rel: locale.atof, locale.atoi, locale.currency, locale.Error
Ref: docs.python.org — locale.normalize
Tags: #public #python3 #stdlib #locale
Import
import locale
from locale import normalize
Signature & Overview
locale.normalize(localename)
Returns a normalized locale code for the given locale name.
Usage
import locale
assert "UTF-8" in locale.normalize("en_US.utf8") or "utf" in locale.normalize("en_US.utf8").lower()
Gotchas
- Normalizes shorthand locale names like
"en_US"or"fr"into OS-recognized locale strings.
REPL Inspect
from locale import normalize
help(normalize)
Linked from
Related notes
- tuts/python3/stdlib_module/locale/localeconv Linked here; links to this page; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/setlocale 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/getencoding shared tags: #locale, #stdlib