From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 10 Mar 2026 14:26:18 +0000 (+0100) Subject: [3.13] gh-106318: Add examples for str.isspace() docs (GH-145399) (#145753) X-Git-Tag: v3.13.13~110 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=973323e6f7d1c8fc267d8a582b524bcc1cb3b9cb;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-106318: Add examples for str.isspace() docs (GH-145399) (#145753) Co-authored-by: Adorilson Bezerra --- diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index edac63e0e969..305b9db47bda 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2096,17 +2096,34 @@ expression support in the :mod:`re` module). >>> '\t'.isprintable(), '\n'.isprintable() (False, False) + See also :meth:`isspace`. + .. method:: str.isspace() Return ``True`` if there are only whitespace characters in the string and there is at least one character, ``False`` otherwise. + For example: + + .. doctest:: + + >>> ''.isspace() + False + >>> ' '.isspace() + True + >>> '\t\n'.isspace() # TAB and BREAK LINE + True + >>> '\u3000'.isspace() # IDEOGRAPHIC SPACE + True + A character is *whitespace* if in the Unicode character database (see :mod:`unicodedata`), either its general category is ``Zs`` ("Separator, space"), or its bidirectional class is one of ``WS``, ``B``, or ``S``. + See also :meth:`isprintable`. + .. method:: str.istitle()