[3.13] gh-106318: Add example for str.center() (GH-134518) (#134572)

Co-authored-by: Blaise Pabon <blaise@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-05-23 11:50:17 +02:00 committed by GitHub
parent c6497d632d
commit 5b203f511b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1652,8 +1652,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]])