Skip to content

Commit 9d9aa84

Browse files
committed
gh-106318: Add examples for str.isspace() docs
1 parent 9768085 commit 9d9aa84

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
@@ -2247,17 +2247,34 @@ expression support in the :mod:`re` module).
22472247
>>> '\t'.isprintable(), '\n'.isprintable()
22482248
(False, False)
22492249

2250+
See also :meth:`isspace`.
2251+
22502252

22512253
.. method:: str.isspace()
22522254

22532255
Return ``True`` if there are only whitespace characters in the string and there is
22542256
at least one character, ``False`` otherwise.
22552257

2258+
For example:
2259+
2260+
.. doctest::
2261+
2262+
>>> ''.isspace()
2263+
False
2264+
>>> ' '.isspace()
2265+
True
2266+
>>> '\t\n'.isspace() # TAB and BREAK LINE
2267+
True
2268+
>>> '\u3000'.isspace() # IDEOGRAPHIC SPACE
2269+
True
2270+
22562271
A character is *whitespace* if in the Unicode character database
22572272
(see :mod:`unicodedata`), either its general category is ``Zs``
22582273
("Separator, space"), or its bidirectional class is one of ``WS``,
22592274
``B``, or ``S``.
22602275

2276+
See also :meth:`isprintable`.
2277+
22612278

22622279
.. method:: str.istitle()
22632280

0 commit comments

Comments
 (0)