unicodedata.east_asian_width
Prev: unicodedata.digit | Up: unicodedata | Next: unicodedata.is_normalized
Rel: unicodedata.bidirectional, unicodedata.category, unicodedata.combining, unicodedata.decimal
Ref: docs.python.org — unicodedata.east_asian_width
Tags: #public #python3 #stdlib #unicodedata
Import
import unicodedata
from unicodedata import east_asian_width
Signature & Overview
unicodedata.east_asian_width(chr, /)
Returns the east asian width assigned to the character chr as string.
Usage
import unicodedata
assert unicodedata.east_asian_width('A') == 'Na'
assert unicodedata.east_asian_width('漢') == 'W'
Gotchas
- Returns
'W'/'F'for double-width CJK terminal cells (useful for TUI column alignment).
REPL Inspect
from unicodedata import east_asian_width
help(east_asian_width)
Linked from
Related notes
- tuts/python3/stdlib_module/unicodedata/digit Linked here; links to this page; shared tags: #stdlib, #unicodedata
- tuts/python3/stdlib_module/unicodedata/is_normalized Linked here; links to this page; shared tags: #stdlib, #unicodedata
- tuts/python3/stdlib_module/unicodedata Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/unicodedata/bidirectional Linked here; shared tags: #stdlib, #unicodedata
- tuts/python3/stdlib_module/unicodedata/category Linked here; shared tags: #stdlib, #unicodedata
- tuts/python3/stdlib_module/unicodedata/combining Linked here; shared tags: #stdlib, #unicodedata
- tuts/python3/stdlib_module/unicodedata/decimal Linked here; shared tags: #stdlib, #unicodedata
- tuts/python3/stdlib_module/unicodedata/decomposition shared tags: #stdlib, #unicodedata
- tuts/python3/stdlib_module/unicodedata/lookup shared tags: #stdlib, #unicodedata
- tuts/python3/stdlib_module/unicodedata/mirrored shared tags: #stdlib, #unicodedata