Skip to content

Commit 427214e

Browse files
committed
gh-106318: Add example for str.isalnum()
1 parent ac028d7 commit 427214e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,6 +1980,16 @@ expression support in the :mod:`re` module).
19801980
of the following returns ``True``: ``c.isalpha()``, ``c.isdecimal()``,
19811981
``c.isdigit()``, or ``c.isnumeric()``.
19821982

1983+
For example::
1984+
1985+
>>> ''.isalnum()
1986+
False
1987+
>>> 'abc123'.isalnum()
1988+
True
1989+
>>> 'abc123!@#'.isalnum()
1990+
False
1991+
>>> ' '.isalnum()
1992+
False
19831993

19841994
.. method:: str.isalpha()
19851995

0 commit comments

Comments
 (0)