Skip to content

Commit 546fb5f

Browse files
committed
gh-106318: Add examples for str.isnumeric()
1 parent 123bbfd commit 546fb5f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2156,6 +2156,20 @@ expression support in the :mod:`re` module).
21562156
VULGAR FRACTION ONE FIFTH. Formally, numeric characters are those with the property
21572157
value Numeric_Type=Digit, Numeric_Type=Decimal or Numeric_Type=Numeric.
21582158

2159+
For example::
2160+
2161+
>>> '0123456789'.isnumeric()
2162+
True
2163+
>>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() #ARABIC-INDIC DIGIT ZERO TO NINE
2164+
True
2165+
>>> '⅕'.isnumeric() # VULGAR FRACTION ONE FIFTH
2166+
True
2167+
>>> '²'.isdigit(), '²'.isdecimal(), '²'.isnumeric()
2168+
(True, False, True)
2169+
2170+
See also :meth:`isdecimal` and :meth:`isdigit`. Numeric characters is a
2171+
decimal numbers superset.
2172+
21592173

21602174
.. method:: str.isprintable()
21612175

0 commit comments

Comments
 (0)