On this page
unicodedata.digit
Prev: unicodedata.decomposition | Up: unicodedata | Next: unicodedata.east_asian_width
Rel: unicodedata.bidirectional, unicodedata.category, unicodedata.combining, unicodedata.decimal
Ref: docs.python.org — unicodedata.digit
Tags: #public #python3 #stdlib #unicodedata
Import
import unicodedata
from unicodedata import digit
Signature & Overview
unicodedata.digit(...)
Converts a Unicode character into its equivalent digit value.
Usage
import unicodedata
assert unicodedata.digit('²') == 2 # superscript 2 is a digit (not decimal)
Gotchas
- Broader than
decimal(): Includes superscripts/subscripts;numeric()is broader still (includes fractions like'½').
REPL Inspect
from unicodedata import digit
help(digit)
Linked from
Related notes
- tuts/python3/stdlib_module/unicodedata/decomposition Linked here; links to this page; shared tags: #stdlib, #unicodedata
- tuts/python3/stdlib_module/unicodedata/east_asian_width 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/is_normalized shared tags: #stdlib, #unicodedata
- tuts/python3/stdlib_module/unicodedata/lookup shared tags: #stdlib, #unicodedata
- tuts/python3/stdlib_module/unicodedata/mirrored shared tags: #stdlib, #unicodedata