https://github.com/python/cpython/commit/ec2619c0800d0122dab35ed7cc4e8a6509a67802 commit: ec2619c0800d0122dab35ed7cc4e8a6509a67802 branch: main author: Adorilson Bezerra <[email protected]> committer: hugovk <[email protected]> date: 2025-12-16T13:39:20+02:00 summary:
gh-106318: Add examples for str.ljust() method (#142719) Co-authored-by: Stan Ulbrych <[email protected]> files: M Doc/library/stdtypes.rst diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 5cfa888706f9b9..5a2021e31ee4e3 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() _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
