locale

Stdlib — i18nPython 2.0+Advanced

Locale-aware formatting for numbers, currency, and dates

Quick Info

Documentation
Official Docs
Python Version
2.0+
Dependencies
None — Python Standard Library
Install
Included with Python

Learn by Difficulty

Quick Example

python
# locale module
print("locale provides locale-aware formatting")
print("Usage: locale.setlocale(locale.LC_ALL, '')")
print("  locale.currency(1234.56)")
print("  locale.format_string('%d', 1234567, grouping=True)")

The locale module is part of Python's standard library. Locale-aware formatting for numbers, currency, and dates.

Try in Playground

Tags

stdlibinternationalizationlocale