From 16e7205d439b9cbbcd34e9f93b7e1dae8fef83a5 Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Sun, 14 Dec 2025 18:12:12 +0000 Subject: [PATCH] gh-106318: Add examples for str.isnumeric() (GH-142680) (cherry picked from commit 3596dba691a6efdff16e04cf05b176c75ae54481) Co-authored-by: Adorilson Bezerra Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- Doc/library/stdtypes.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index fa5014c9eac7fc..5f2f0b7a887a1f 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2019,6 +2019,21 @@ expression support in the :mod:`re` module). that have the Unicode numeric value property, e.g. U+2155, VULGAR FRACTION ONE FIFTH. Formally, numeric characters are those with the property value Numeric_Type=Digit, Numeric_Type=Decimal or Numeric_Type=Numeric. + For example: + + .. doctest:: + + >>> '0123456789'.isnumeric() + True + >>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # Arabic-indic digit zero to nine + True + >>> '⅕'.isnumeric() # Vulgar fraction one fifth + True + >>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric() + (False, True, True) + + See also :meth:`isdecimal` and :meth:`isdigit`. Numeric characters are + a superset of decimal numbers. .. method:: str.isprintable()