Skip to content

Commit 70e2346

Browse files
committed
gh-106318: Add example for str.isdecimal()
1 parent 34d7351 commit 70e2346

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Doc/library/stdtypes.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,16 @@ expression support in the :mod:`re` module).
20082008
otherwise. Decimal characters are those that can be used to form
20092009
numbers in base 10, e.g. U+0660, ARABIC-INDIC DIGIT
20102010
ZERO. Formally a decimal character is a character in the Unicode
2011-
General Category "Nd".
2011+
General Category "Nd". For example::
2012+
2013+
.. doctest::
2014+
2015+
>>> '0123456789'.isdecimal()
2016+
True
2017+
>>> '٠١٢٣٤٥٦٧٨٩'.isdecimal() # ARABIC-INDIC DIGIT ZERO TO NINE
2018+
True
2019+
>>> 'alphabetic'.isdecimal()
2020+
False
20122021

20132022

20142023
.. method:: str.isdigit()
@@ -2020,7 +2029,6 @@ expression support in the :mod:`re` module).
20202029
like the Kharosthi numbers. Formally, a digit is a character that has the
20212030
property value Numeric_Type=Digit or Numeric_Type=Decimal.
20222031

2023-
20242032
.. method:: str.isidentifier()
20252033

20262034
Return ``True`` if the string is a valid identifier according to the language

0 commit comments

Comments
 (0)