Skip to content

Commit 03724cd

Browse files
adorilsonStanFromIreland
authored andcommitted
gh-106318: Add examples for str.ljust() method (GH-142719)
(cherry picked from commit ec2619c) Co-authored-by: Adorilson Bezerra <adorilson@gmail.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
1 parent 4ad9844 commit 03724cd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,6 +2125,19 @@ expression support in the :mod:`re` module).
21252125
done using the specified *fillchar* (default is an ASCII space). The
21262126
original string is returned if *width* is less than or equal to ``len(s)``.
21272127

2128+
For example:
2129+
2130+
.. doctest::
2131+
2132+
>>> 'Python'.ljust(10)
2133+
'Python '
2134+
>>> 'Python'.ljust(10, '.')
2135+
'Python....'
2136+
>>> 'Monty Python'.ljust(10, '.')
2137+
'Monty Python'
2138+
2139+
See also :meth:`rjust`.
2140+
21282141

21292142
.. method:: str.lower()
21302143

0 commit comments

Comments
 (0)