From f402195c9abf9328ac27987ccbf221b0f7094978 Mon Sep 17 00:00:00 2001 From: Blaise Pabon Date: Fri, 13 Jun 2025 15:44:21 +0000 Subject: [PATCH] gh-106318: Add example for `str.expandtabs()` (GH-134525) (cherry picked from commit 14c1d093d52d8de32c486808c1e1e85e0f61c11c) Co-authored-by: Blaise Pabon --- 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 7fe33d44b3a6d6..87855970b64979 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -1755,12 +1755,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]])