On this page
unicodedata.numeric
Prev: unicodedata.normalize | Up: unicodedata | Next: unicodedata.UCD
Rel: unicodedata.bidirectional, unicodedata.category, unicodedata.combining, unicodedata.decimal
Ref: docs.python.org — unicodedata.numeric
Tags: #public #python3 #stdlib #unicodedata
Import
import unicodedata
from unicodedata import numeric
Signature & Overview
unicodedata.numeric(...)
Converts a Unicode character into its equivalent numeric value.
Usage
import unicodedata
assert unicodedata.numeric('½') == 0.5
assert unicodedata.numeric('x', -1.0) == -1.0
Gotchas
- Always returns
float(unlikedecimal()/digit()which returnint).
REPL Inspect
from unicodedata import numeric
help(numeric)
Linked from
Related notes
- tuts/python3/stdlib_module/unicodedata/normalize Linked here; links to this page; shared tags: #stdlib, #unicodedata
- tuts/python3/stdlib_module/unicodedata/UCD 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/digit shared tags: #stdlib, #unicodedata
- tuts/python3/stdlib_module/unicodedata/east_asian_width shared tags: #stdlib, #unicodedata