Skip to content

Commit 4480424

Browse files
committed
[Doc] Added snippet code to str.isprintable method
1 parent 5f91d5d commit 4480424

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,6 +2123,8 @@ expression support in the :mod:`re` module).
21232123
value Numeric_Type=Digit, Numeric_Type=Decimal or Numeric_Type=Numeric.
21242124

21252125

2126+
.. _meth-str-isprintable:
2127+
21262128
.. method:: str.isprintable()
21272129

21282130
Return ``True`` if all characters in the string are printable, ``False`` if it
@@ -2139,6 +2141,15 @@ expression support in the :mod:`re` module).
21392141
Nonprintable characters are those in group Separator or Other (Z or C),
21402142
except the ASCII space.
21412143

2144+
For example:
2145+
2146+
.. doctest::
2147+
2148+
>>> ''.isprintable(), ' '.isprintable()
2149+
(True, True)
2150+
>>> '\t'.isprintable(), '\n'.isprintable() # TAB and BREAK LINE
2151+
(False, False)
2152+
21422153

21432154
.. method:: str.isspace()
21442155

0 commit comments

Comments
 (0)