Skip to content

Commit a31020b

Browse files
committed
gh-106318: Add examples for str.rjust() method
1 parent c461aa9 commit a31020b

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
@@ -2554,6 +2554,19 @@ expression support in the :mod:`re` module).
25542554
done using the specified *fillchar* (default is an ASCII space). The
25552555
original string is returned if *width* is less than or equal to ``len(s)``.
25562556

2557+
For example:
2558+
2559+
.. doctest::
2560+
2561+
>>> 'Python'.rjust(10)
2562+
' Python'
2563+
>>> 'Python'.rjust(10, '.')
2564+
'....Python'
2565+
>>> 'Monty Python'.rjust(10, '.')
2566+
'Monty Python'
2567+
2568+
See also :meth:`ljust` and :meth:`zfill`.
2569+
25572570

25582571
.. method:: str.rpartition(sep, /)
25592572

0 commit comments

Comments
 (0)