Skip to content

Commit ec8d2f9

Browse files
committed
gh-106318: Add examples for str.ljust() method
1 parent f48c619 commit ec8d2f9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Doc/library/stdtypes.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2261,12 +2261,16 @@ expression support in the :mod:`re` module).
22612261
done using the specified *fillchar* (default is an ASCII space). The
22622262
original string is returned if *width* is less than or equal to ``len(s)``.
22632263

2264-
For example::
2264+
For example:
2265+
2266+
.. doctest::
22652267

22662268
>>> 'Python'.ljust(10)
22672269
'Python '
22682270
>>> 'Python'.ljust(10, '.')
22692271
'Python....'
2272+
>>> 'Monty Python'.ljust(10, '.')
2273+
'Monty Python'
22702274

22712275
See also :meth:`rjust`.
22722276

0 commit comments

Comments
 (0)