mirror of
https://github.com/python/cpython.git
synced 2026-04-14 07:41:00 +00:00
[3.14] gh-106318: Add examples for str.isspace() docs (GH-145399) (#145752)
Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
This commit is contained in:
parent
50eafe77ef
commit
387abcce91
1 changed files with 17 additions and 0 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue