On this page
  1. unicodedata.category
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

unicodedata.category

Prev: unicodedata.bidirectional | Up: unicodedata | Next: unicodedata.combining
Rel: unicodedata.bidirectional, unicodedata.combining, unicodedata.decimal, unicodedata.decomposition
Ref: docs.python.org — unicodedata.category
Tags: #public #python3 #stdlib #unicodedata


Import

import unicodedata
from unicodedata import category

Signature & Overview

unicodedata.category(chr, /)

Returns the general category assigned to the character chr as string.

Usage

import unicodedata

assert unicodedata.category('A') == 'Lu'   # Letter, uppercase
assert unicodedata.category('3') == 'Nd'   # Number, decimal digit
assert unicodedata.category('\u0301') == 'Mn'   # Mark, nonspacing (combining accent)

Gotchas

REPL Inspect

from unicodedata import category
help(category)

Linked from

Related notes