Skip to content

Commit 8a508e0

Browse files
committed
[Doc] Added snippet code to str.replace method
1 parent cea2d24 commit 8a508e0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,6 +2402,12 @@ expression support in the :mod:`re` module).
24022402
.. versionchanged:: 3.13
24032403
*count* is now supported as a keyword argument.
24042404

2405+
For example::
2406+
2407+
>>> 'spam, spam, spam'.replace('spam', 'eggs')
2408+
'eggs, eggs, eggs'
2409+
>>> 'spam, spam, spam'.replace('spam', 'eggs', 1)
2410+
'eggs, spam, spam'
24052411

24062412
.. method:: str.rfind(sub[, start[, end]])
24072413

0 commit comments

Comments
 (0)