mirror of
https://github.com/python/cpython.git
synced 2026-02-06 01:45:25 +00:00
Merge fce429bd08 into b6d8aa436b
This commit is contained in:
commit
fa91c66f65
1 changed files with 18 additions and 1 deletions
|
|
@ -2570,6 +2570,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'.rjust(10)
|
||||
' Python'
|
||||
>>> 'Python'.rjust(10, '.')
|
||||
'....Python'
|
||||
>>> 'Monty Python'.rjust(10, '.')
|
||||
'Monty Python'
|
||||
|
||||
See also :meth:`ljust` and :meth:`zfill`.
|
||||
|
||||
|
||||
.. method:: str.rpartition(sep, /)
|
||||
|
||||
|
|
@ -2871,13 +2884,17 @@ expression support in the :mod:`re` module).
|
|||
than before. The original string is returned if *width* is less than
|
||||
or equal to ``len(s)``.
|
||||
|
||||
For example::
|
||||
For example:
|
||||
|
||||
.. doctest::
|
||||
|
||||
>>> "42".zfill(5)
|
||||
'00042'
|
||||
>>> "-42".zfill(5)
|
||||
'-0042'
|
||||
|
||||
See also :meth:`rjust`.
|
||||
|
||||
|
||||
.. index::
|
||||
single: ! formatted string literal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue