From: Adorilson Bezerra Date: Tue, 16 Dec 2025 11:39:20 +0000 (+0000) Subject: gh-106318: Add examples for str.ljust() method (#142719) X-Git-Tag: v3.15.0a3~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec2619c0800d0122dab35ed7cc4e8a6509a67802;p=thirdparty%2FPython%2Fcpython.git gh-106318: Add examples for str.ljust() method (#142719) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 5cfa888706f9..5a2021e31ee4 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2261,6 +2261,19 @@ 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: + + .. doctest:: + + >>> 'Python'.ljust(10) + 'Python ' + >>> 'Python'.ljust(10, '.') + 'Python....' + >>> 'Monty Python'.ljust(10, '.') + 'Monty Python' + + See also :meth:`rjust`. + .. method:: str.lower()