Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5b203f5

Browse files
[3.13]gh-106318: Add example forstr.center() (GH-134518) (#134572)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
1 parentc6497d6 commit5b203f5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎Doc/library/stdtypes.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,8 +1652,14 @@ expression support in the :mod:`re` module).
16521652

16531653
Return centered in a string of length *width*. Padding is done using the
16541654
specified *fillchar* (default is an ASCII space). The original string is
1655-
returned if *width* is less than or equal to ``len(s)``.
1656-
1655+
returned if *width* is less than or equal to ``len(s)``. For example::
1656+
1657+
>>> 'Python'.center(10)
1658+
' Python '
1659+
>>> 'Python'.center(10, '-')
1660+
'--Python--'
1661+
>>> 'Python'.center(4)
1662+
'Python'
16571663

16581664

16591665
..method::str.count(sub[, start[, end]])

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp