Skip to content

Latest commit

 

History

History
22 lines (15 loc) · 524 Bytes

python.md

File metadata and controls

22 lines (15 loc) · 524 Bytes

Sorting with the UCA in Python

Sorting using the Unicode Collation Algorithm (UCA) is available with PyPi package PyICU.

from PyICU import Collator

collator = Collator.createInstance()
sorted = sorted(unsorted, key=collator.getSortKey)

Linguistic tailoring

The PyICU package also supports linguistic tailoring.

from PyICU import Collator, Locale

collator = Collator.createInstance(Locale('de'))
sorted = sorted(unsorted, key=collator.getSortKey)