Skip to content

Commit 43b9344

Browse files
[3.13] gh-106318: Add example for str.isalnum() (GH-137550) (#144610)
gh-106318: Add example for str.isalnum() (GH-137550) (cherry picked from commit 3dd7a3c) Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
1 parent 57aaee5 commit 43b9344

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Doc/library/stdtypes.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1939,7 +1939,18 @@ expression support in the :mod:`re` module).
19391939
Return ``True`` if all characters in the string are alphanumeric and there is at
19401940
least one character, ``False`` otherwise. A character ``c`` is alphanumeric if one
19411941
of the following returns ``True``: ``c.isalpha()``, ``c.isdecimal()``,
1942-
``c.isdigit()``, or ``c.isnumeric()``.
1942+
``c.isdigit()``, or ``c.isnumeric()``. For example::
1943+
1944+
.. doctest::
1945+
1946+
>>> 'abc123'.isalnum()
1947+
True
1948+
>>> 'abc123!@#'.isalnum()
1949+
False
1950+
>>> ''.isalnum()
1951+
False
1952+
>>> ' '.isalnum()
1953+
False
19431954

19441955

19451956
.. method:: str.isalpha()

0 commit comments

Comments
 (0)