From f48c619c812ab475e3d64105d8250c6be5b6c21d Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Tue, 11 May 2021 21:05:50 -0300 Subject: [PATCH 1/3] [Doc] Added snippet code to str.ljust method --- Doc/library/stdtypes.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index a0b78f8053764b..62e44d35ff88ba 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2261,6 +2261,14 @@ expression support in the :mod:`re` module). done using the specified *fillchar* (default is an ASCII space). The original string is returned if *width* is less than or equal to ``len(s)``. + For example:: + + >>> 'Python'.ljust(10) + 'Python ' + >>> 'Python'.ljust(10, '.') + 'Python....' + + See also :meth:`rjust`. .. method:: str.lower() From ec8d2f94e87f983abef6ca2427b5f96d6e9e16ae Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Sun, 14 Dec 2025 18:54:25 +0000 Subject: [PATCH 2/3] gh-106318: Add examples for str.ljust() method --- Doc/library/stdtypes.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 62e44d35ff88ba..7db42f7eafe137 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2261,12 +2261,16 @@ expression support in the :mod:`re` module). done using the specified *fillchar* (default is an ASCII space). The original string is returned if *width* is less than or equal to ``len(s)``. - For example:: + For example: + + .. doctest:: >>> 'Python'.ljust(10) 'Python ' >>> 'Python'.ljust(10, '.') 'Python....' + >>> 'Monty Python'.ljust(10, '.') + 'Monty Python' See also :meth:`rjust`. From a1d3ed7df7aa16e8d9b274bd35cdb5bc09ae5c32 Mon Sep 17 00:00:00 2001 From: Adorilson Bezerra Date: Mon, 15 Dec 2025 10:29:00 +0000 Subject: [PATCH 3/3] Update Doc/library/stdtypes.rst Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- Doc/library/stdtypes.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 7db42f7eafe137..ed777d1f634203 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2274,6 +2274,7 @@ expression support in the :mod:`re` module). See also :meth:`rjust`. + .. method:: str.lower() Return a copy of the string with all the cased characters [4]_ converted to