Skip to content

Commit f402195

Browse files
blaisepmiss-islington
authored andcommitted
pythongh-106318: Add example for str.expandtabs() (pythonGH-134525)
(cherry picked from commit 14c1d09) Co-authored-by: Blaise Pabon <[email protected]>
1 parent 0430135 commit f402195

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
@@ -1755,12 +1755,15 @@ expression support in the :mod:`re` module).
17551755
(``\n``) or return (``\r``), it is copied and the current column is reset to
17561756
zero. Any other character is copied unchanged and the current column is
17571757
incremented by one regardless of how the character is represented when
1758-
printed.
1758+
printed. For example::
17591759

17601760
>>> '01\t012\t0123\t01234'.expandtabs()
17611761
'01 012 0123 01234'
17621762
>>> '01\t012\t0123\t01234'.expandtabs(4)
17631763
'01 012 0123 01234'
1764+
>>> print('01\t012\n0123\t01234'.expandtabs(4))
1765+
01 012
1766+
0123 01234
17641767

17651768

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

0 commit comments

Comments
 (0)