Skip to content

Commit 14c1d09

Browse files
authored
gh-106318: Add example for str.expandtabs() (#134525)
1 parent afc5ab6 commit 14c1d09

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Doc/library/stdtypes.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1891,12 +1891,15 @@ expression support in the :mod:`re` module).
18911891
(``\n``) or return (``\r``), it is copied and the current column is reset to
18921892
zero. Any other character is copied unchanged and the current column is
18931893
incremented by one regardless of how the character is represented when
1894-
printed.
1894+
printed. For example::
18951895

18961896
>>> '01\t012\t0123\t01234'.expandtabs()
18971897
'01 012 0123 01234'
18981898
>>> '01\t012\t0123\t01234'.expandtabs(4)
18991899
'01 012 0123 01234'
1900+
>>> print('01\t012\n0123\t01234'.expandtabs(4))
1901+
01 012
1902+
0123 01234
19001903

19011904

19021905
.. method:: str.find(sub[, start[, end]])

0 commit comments

Comments
 (0)