]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106318: Add example for `str.expandtabs()` (#134525)
authorBlaise Pabon <blaise@gmail.com>
Fri, 13 Jun 2025 15:44:21 +0000 (15:44 +0000)
committerGitHub <noreply@github.com>
Fri, 13 Jun 2025 15:44:21 +0000 (18:44 +0300)
Doc/library/stdtypes.rst

index 0954e3409a2dcc70e38fed374d52b9efc9762cee..394c302fd354b9611d8df6a33586a0e54c9053db 100644 (file)
@@ -1891,12 +1891,15 @@ expression support in the :mod:`re` module).
    (``\n``) or return (``\r``), it is copied and the current column is reset to
    zero.  Any other character is copied unchanged and the current column is
    incremented by one regardless of how the character is represented when
-   printed.
+   printed. For example::
 
       >>> '01\t012\t0123\t01234'.expandtabs()
       '01      012     0123    01234'
       >>> '01\t012\t0123\t01234'.expandtabs(4)
       '01  012 0123    01234'
+      >>> print('01\t012\n0123\t01234'.expandtabs(4))
+      01  012
+      0123    01234
 
 
 .. method:: str.find(sub[, start[, end]])