From d133f26d40f1dde118ed9a64b4c145af8509745f Mon Sep 17 00:00:00 2001 From: blaisep Date: Thu, 22 May 2025 12:37:27 -0400 Subject: [PATCH] Add example for `str.expandtabs()` WIP to fix #106318 using the contributions from https://github.com/python/cpython/pull/105670 --- Doc/library/stdtypes.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 3486a18b5cb1f0..addf21720eb369 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1850,12 +1850,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]])