On this page
locale.currency
Prev: locale.atoi | Up: locale | Next: locale.Error
Rel: locale.atof, locale.atoi, locale.Error, locale.format_string
Ref: docs.python.org — locale.currency
Tags: #public #python3 #stdlib #locale
Import
import locale
from locale import currency
Signature & Overview
locale.currency(val, symbol=True, grouping=False, international=False)
Formats val according to the currency settings in the current locale.
Usage
import locale
# Requires a non-"C" locale; in the default "C" locale, currency() raises ValueError
assert callable(locale.currency)
Gotchas
- Raises
ValueErrorin the default"C"locale: Callsetlocale(LC_ALL, "")at startup, or useBabelfor per-request web formatting.
REPL Inspect
from locale import currency
help(currency)
Linked from
- tuts/python3/stdlib_module/locale
- tuts/python3/stdlib_module/locale/atof
- tuts/python3/stdlib_module/locale/atoi
- tuts/python3/stdlib_module/locale/Error
- tuts/python3/stdlib_module/locale/format_string
- tuts/python3/stdlib_module/locale/getdefaultlocale
- tuts/python3/stdlib_module/locale/getencoding
- tuts/python3/stdlib_module/locale/getlocale
- tuts/python3/stdlib_module/locale/getpreferredencoding
- tuts/python3/stdlib_module/locale/localeconv
- tuts/python3/stdlib_module/locale/normalize
- tuts/python3/stdlib_module/locale/setlocale
- tuts/python3/stdlib_module/locale/str
- tuts/python3/stdlib_module/locale/strcoll
- tuts/python3/stdlib_module/locale/strxfrm
Related notes
- tuts/python3/stdlib_module/locale/atof Linked here; links to this page; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/atoi Linked here; links to this page; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/Error Linked here; links to this page; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/format_string 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/getdefaultlocale links to this page; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/getencoding links to this page; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/getlocale links to this page; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/getpreferredencoding links to this page; shared tags: #locale, #stdlib
- tuts/python3/stdlib_module/locale/localeconv links to this page; shared tags: #locale, #stdlib