ch04: update from book draft
This commit is contained in:
6
04-text-byte/locale_sort.py
Normal file
6
04-text-byte/locale_sort.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import locale
|
||||
my_locale = locale.setlocale(locale.LC_COLLATE, 'pt_BR.UTF-8')
|
||||
print(my_locale)
|
||||
fruits = ['caju', 'atemoia', 'cajá', 'açaí', 'acerola']
|
||||
sorted_fruits = sorted(fruits, key=locale.strxfrm)
|
||||
print(sorted_fruits)
|
||||
Reference in New Issue
Block a user