X Tutup
Skip to content

Commit 973323e

Browse files
[3.13] gh-106318: Add examples for str.isspace() docs (GH-145399) (#145753)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
1 parent d12aed1 commit 973323e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,17 +2096,34 @@ expression support in the :mod:`re` module).
20962096
>>> '\t'.isprintable(), '\n'.isprintable()
20972097
(False, False)
20982098

2099+
See also :meth:`isspace`.
2100+
20992101

21002102
.. method:: str.isspace()
21012103

21022104
Return ``True`` if there are only whitespace characters in the string and there is
21032105
at least one character, ``False`` otherwise.
21042106

2107+
For example:
2108+
2109+
.. doctest::
2110+
2111+
>>> ''.isspace()
2112+
False
2113+
>>> ' '.isspace()
2114+
True
2115+
>>> '\t\n'.isspace() # TAB and BREAK LINE
2116+
True
2117+
>>> '\u3000'.isspace() # IDEOGRAPHIC SPACE
2118+
True
2119+
21052120
A character is *whitespace* if in the Unicode character database
21062121
(see :mod:`unicodedata`), either its general category is ``Zs``
21072122
("Separator, space"), or its bidirectional class is one of ``WS``,
21082123
``B``, or ``S``.
21092124

2125+
See also :meth:`isprintable`.
2126+
21102127

21112128
.. method:: str.istitle()
21122129

0 commit comments

Comments
 (0)
X Tutup