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

Commit1dbb644

Browse files
[3.13]gh-106318: Add example forstr.count() (GH-134519) (#134573)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
1 parent5b203f5 commit1dbb644

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

‎Doc/library/stdtypes.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,8 +1669,18 @@ expression support in the :mod:`re` module).
16691669
interpreted as in slice notation.
16701670

16711671
If *sub* is empty, returns the number of empty strings between characters
1672-
which is the length of the string plus one.
1673-
1672+
which is the length of the string plus one. For example::
1673+
1674+
>>> 'spam, spam, spam'.count('spam')
1675+
3
1676+
>>> 'spam, spam, spam'.count('spam', 5)
1677+
2
1678+
>>> 'spam, spam, spam'.count('spam', 5, 10)
1679+
1
1680+
>>> 'spam, spam, spam'.count('eggs')
1681+
0
1682+
>>> 'spam, spam, spam'.count('')
1683+
17
16741684

16751685
..method::str.encode(encoding="utf-8", errors="strict")
16761686

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp