https://github.com/python/cpython/commit/9585f509d796cc3f89e85d4cb9e52e4f10604a01
commit: 9585f509d796cc3f89e85d4cb9e52e4f10604a01
branch: main
author: Adorilson Bezerra <[email protected]>
committer: hugovk <[email protected]>
date: 2026-03-10T16:19:24+02:00
summary:
gh-106318: Add examples for str.isspace() docs (#145399)
files:
M Doc/library/stdtypes.rst
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index c930b876b3ccbf..bfa49b62ec5778 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -2247,17 +2247,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()
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]