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

Commit1729468

Browse files
authored
gh-106318: Add example forstr.count() (#134519)
1 parentda9b5c1 commit1729468

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
@@ -1805,8 +1805,18 @@ expression support in the :mod:`re` module).
18051805
interpreted as in slice notation.
18061806

18071807
If *sub* is empty, returns the number of empty strings between characters
1808-
which is the length of the string plus one.
1809-
1808+
which is the length of the string plus one. For example::
1809+
1810+
>>> 'spam, spam, spam'.count('spam')
1811+
3
1812+
>>> 'spam, spam, spam'.count('spam', 5)
1813+
2
1814+
>>> 'spam, spam, spam'.count('spam', 5, 10)
1815+
1
1816+
>>> 'spam, spam, spam'.count('eggs')
1817+
0
1818+
>>> 'spam, spam, spam'.count('')
1819+
17
18101820

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp