Skip to content

Commit e6cf6c2

Browse files
adorilsonhugovk
authored andcommitted
gh-106318: Add example for str.isdecimal() (GH-137559)
(cherry picked from commit 6462322) Co-authored-by: Adorilson Bezerra <adorilson@gmail.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
1 parent 47cb43c commit e6cf6c2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Doc/library/stdtypes.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1937,9 +1937,18 @@ expression support in the :mod:`re` module).
19371937
Return ``True`` if all characters in the string are decimal
19381938
characters and there is at least one character, ``False``
19391939
otherwise. Decimal characters are those that can be used to form
1940-
numbers in base 10, e.g. U+0660, ARABIC-INDIC DIGIT
1940+
numbers in base 10, such as U+0660, ARABIC-INDIC DIGIT
19411941
ZERO. Formally a decimal character is a character in the Unicode
1942-
General Category "Nd".
1942+
General Category "Nd". For example:
1943+
1944+
.. doctest::
1945+
1946+
>>> '0123456789'.isdecimal()
1947+
True
1948+
>>> '٠١٢٣٤٥٦٧٨٩'.isdecimal() # Arabic-Indic digits zero to nine
1949+
True
1950+
>>> 'alphabetic'.isdecimal()
1951+
False
19431952

19441953

19451954
.. method:: str.isdigit()

0 commit comments

Comments
 (0)