On this page
  1. locale.strxfrm
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

locale.strxfrm

Prev: locale.strcoll | Up: locale
Rel: locale.atof, locale.atoi, locale.currency, locale.Error
Ref: docs.python.org — locale.strxfrm
Tags: #public #python3 #stdlib #locale


Import

import locale
from locale import strxfrm

Signature & Overview

locale.strxfrm(string, /)

Return a string that can be used as a key for locale-aware comparisons.

Usage

import locale

words = sorted(["b", "a", "c"], key=locale.strxfrm)
assert words == ["a", "b", "c"]

Gotchas

REPL Inspect

from locale import strxfrm
help(strxfrm)

Linked from

Related notes