Skip to content

Commit e72ee65

Browse files
miss-islingtonadorilsonhugovk
authored
[3.13] gh-106318: Add examples for str.isnumeric() (GH-142680) (#142716)
Co-authored-by: Adorilson Bezerra <[email protected]> Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent d2ba756 commit e72ee65

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,6 +2019,21 @@ expression support in the :mod:`re` module).
20192019
that have the Unicode numeric value property, e.g. U+2155,
20202020
VULGAR FRACTION ONE FIFTH. Formally, numeric characters are those with the property
20212021
value Numeric_Type=Digit, Numeric_Type=Decimal or Numeric_Type=Numeric.
2022+
For example:
2023+
2024+
.. doctest::
2025+
2026+
>>> '0123456789'.isnumeric()
2027+
True
2028+
>>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # Arabic-indic digit zero to nine
2029+
True
2030+
>>> ''.isnumeric() # Vulgar fraction one fifth
2031+
True
2032+
>>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric()
2033+
(False, True, True)
2034+
2035+
See also :meth:`isdecimal` and :meth:`isdigit`. Numeric characters are
2036+
a superset of decimal numbers.
20222037

20232038

20242039
.. method:: str.isprintable()

0 commit comments

Comments
 (0)