Skip to content

Commit 7a1058b

Browse files
committed
gh-106318: Some improvements to str.isalnum() example
1 parent 427214e commit 7a1058b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Doc/library/stdtypes.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,19 +1978,20 @@ expression support in the :mod:`re` module).
19781978
Return ``True`` if all characters in the string are alphanumeric and there is at
19791979
least one character, ``False`` otherwise. A character ``c`` is alphanumeric if one
19801980
of the following returns ``True``: ``c.isalpha()``, ``c.isdecimal()``,
1981-
``c.isdigit()``, or ``c.isnumeric()``.
1981+
``c.isdigit()``, or ``c.isnumeric()``. For example::
19821982

1983-
For example::
1983+
.. doctest::
19841984

1985-
>>> ''.isalnum()
1986-
False
19871985
>>> 'abc123'.isalnum()
19881986
True
19891987
>>> 'abc123!@#'.isalnum()
19901988
False
1989+
>>> ''.isalnum()
1990+
False
19911991
>>> ' '.isalnum()
19921992
False
19931993

1994+
19941995
.. method:: str.isalpha()
19951996

19961997
Return ``True`` if all characters in the string are alphabetic and there is at least

0 commit comments

Comments
 (0)