Skip to content

Commit d133f26

Browse files
committed
Add example for str.expandtabs()
WIP to fix python#106318 using the contributions from python#105670
1 parent 09e72cf commit d133f26

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

18551855
>>> '01\t012\t0123\t01234'.expandtabs()
18561856
'01 012 0123 01234'
18571857
>>> '01\t012\t0123\t01234'.expandtabs(4)
18581858
'01 012 0123 01234'
1859+
>>> print('01\t012\n0123\t01234'.expandtabs(4))
1860+
01 012
1861+
0123 01234
18591862

18601863

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

0 commit comments

Comments
 (0)