Skip to content

Commit 8eeb14d

Browse files
committed
add python sorting
1 parent 8e5c4f1 commit 8eeb14d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

sorting/python.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Sorting with the UCA in Python
2+
3+
Sorting using the Unicode Collation Algorithm (UCA) is available with PyPi
4+
package [PyICU](https://pypi.python.org/pypi/PyICU).
5+
6+
from PyICU import Collator
7+
8+
collator = Collator.createInstance()
9+
sorted = sorted(unsorted, cmp=collator.compare)
10+
11+
## Linguistic tailoring
12+
13+
The PyICU package also supports linguistic tailoring.
14+
15+
from PyICU import Collator, Locale
16+
17+
collator = Collator.createInstance(Locale('de'))
18+
sorted = sorted(unsorted, cmp=collator.compare)

0 commit comments

Comments
 (0)