Skip to content

Latest commit

History

History
22 lines (15 loc) · 524 Bytes

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.

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

Linguistic tailoring

The PyICU package also supports linguistic tailoring.

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