Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add example for str.center()
WIP to fix #106318
  • Loading branch information
blaisep committed May 22, 2025
commit 8f967fa8cd013f0273b87fbd4ef25a872b9b1d9b
10 changes: 8 additions & 2 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1788,8 +1788,14 @@ expression support in the :mod:`re` module).

Return centered in a string of length *width*. Padding is 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)``.

returned if *width* is less than or equal to ``len(s)``. For example::

>>> 'Python'.center(10)
' Python '
>>> 'Python'.center(10, '-')
'--Python--'
>>> 'Python'.center(4)
'Python'


.. method:: str.count(sub[, start[, end]])
Expand Down
Loading