]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-106318: Add examples for str.isprintable() (GH-140043) (#143484)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 6 Jan 2026 16:50:02 +0000 (17:50 +0100)
committerGitHub <noreply@github.com>
Tue, 6 Jan 2026 16:50:02 +0000 (16:50 +0000)
gh-106318: Add examples for str.isprintable()  (GH-140043)
(cherry picked from commit 7b0a372b20ae3b80053d52e84c2b7bdd114c19f0)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Doc/library/stdtypes.rst

index 8f5afea1b6c6dd99071686167d501d78aa6a2a55..9f1bcc9240f0e6afdbdb2617162585a25fe429b9 100644 (file)
@@ -2052,6 +2052,15 @@ expression support in the :mod:`re` module).
    Nonprintable characters are those in group Separator or Other (Z or C),
    except the ASCII space.
 
+   For example:
+
+   .. doctest::
+
+      >>> ''.isprintable(), ' '.isprintable()
+      (True, True)
+      >>> '\t'.isprintable(), '\n'.isprintable()
+      (False, False)
+
 
 .. method:: str.isspace()