ch04: update from book draft
This commit is contained in:
1 parent
a9fb6dc48a
commit
b000813f15
2 files changed
+24
No files matched your search
@@ -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)
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import sys
|
||||||
|
from unicodedata import name
|
||||||
|
|
||||||
|
print(sys.version)
|
||||||
|
print()
|
||||||
|
print('sys.stdout.isatty():', sys.stdout.isatty())
|
||||||
|
print('sys.stdout.encoding:', sys.stdout.encoding)
|
||||||
|
print()
|
||||||
|
|
||||||
|
test_chars = [
|
||||||
|
'\u2026', # HORIZONTAL ELLIPSIS (in cp1252)
|
||||||
|
'\u221E', # INFINITY (in cp437)
|
||||||
|
'\u32B7', # CIRCLED NUMBER FORTY TWO
|
||||||
|
]
|
||||||
|
|
||||||
|
for char in test_chars:
|
||||||
|
print(f'Trying to output {name(char)}:')
|
||||||
|
print(char)
|
||||||
Reference in new issue
Block a user