From: Adorilson Bezerra Date: Sun, 8 Feb 2026 22:08:18 +0000 (+0000) Subject: gh-106318: Add example for str.isalnum() (#137550) X-Git-Tag: v3.15.0a6~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3dd7a3c65ad4ac330ad44a519efa017484530e1a;p=thirdparty%2FPython%2Fcpython.git gh-106318: Add example for str.isalnum() (#137550) --- diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 0f20163e6950..4fc6f3b96521 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2180,7 +2180,18 @@ expression support in the :mod:`re` module). Return ``True`` if all characters in the string are alphanumeric and there is at least one character, ``False`` otherwise. A character ``c`` is alphanumeric if one of the following returns ``True``: ``c.isalpha()``, ``c.isdecimal()``, - ``c.isdigit()``, or ``c.isnumeric()``. + ``c.isdigit()``, or ``c.isnumeric()``. For example:: + + .. doctest:: + + >>> 'abc123'.isalnum() + True + >>> 'abc123!@#'.isalnum() + False + >>> ''.isalnum() + False + >>> ' '.isalnum() + False .. method:: str.isalpha()