example-code-2e/04-text-byte/stdout_check.py

19 lines
487 B
Python
Raw Normal View History

2020-02-19 04:10:33 +01:00
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 = [
2021-07-08 04:45:54 +02:00
'\N{HORIZONTAL ELLIPSIS}', # exists in cp1252, not in cp437
'\N{INFINITY}', # exists in cp437, not in cp1252
'\N{CIRCLED NUMBER FORTY TWO}', # not in cp437 or in cp1252
2020-02-19 04:10:33 +01:00
]
for char in test_chars:
print(f'Trying to output {name(char)}:')
print(char)