Skip to content

Commit 2818224

Browse files
miss-islingtonadorilsonStanFromIreland
authored
[3.13] gh-106318: Add examples for str.ljust() method (GH-142719) (#142803)
Co-authored-by: Adorilson Bezerra <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]>
1 parent 4ad9844 commit 2818224

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)