From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sun, 8 Feb 2026 22:15:45 +0000 (+0100) Subject: [3.13] gh-106318: Add example for str.isalnum() (GH-137550) (#144610) X-Git-Tag: v3.13.13~208 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=43b9344114c11e43aa53e9f66757a184c1ef420e;p=thirdparty%2FPython%2Fcpython.git [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 3dd7a3c65ad4ac330ad44a519efa017484530e1a) Co-authored-by: Adorilson Bezerra --- diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index cca4ed1abdf5..997e897c29e3 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1939,7 +1939,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()