diff options
author | Hugo van Kemenade <hugovk@users.noreply.github.com> | 2023-07-10 09:52:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-10 09:52:36 (GMT) |
commit | 34c14147a2c52930b8b471905074509639e82d5b (patch) | |
tree | b621b5415d714b9ecfe1886ec6e3fdad2295682b /Doc/library/stdtypes.rst | |
parent | dac1e364901d3668742e6eecc2ce63586330c11f (diff) | |
download | cpython-34c14147a2c52930b8b471905074509639e82d5b.zip cpython-34c14147a2c52930b8b471905074509639e82d5b.tar.gz cpython-34c14147a2c52930b8b471905074509639e82d5b.tar.bz2 |
gh-106487: Allow the 'count' argument of `str.replace` to be a keyword (#106488)
Diffstat (limited to 'Doc/library/stdtypes.rst')
-rw-r--r-- | Doc/library/stdtypes.rst | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index 0ac727e..8e049d9 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2014,11 +2014,14 @@ expression support in the :mod:`re` module). .. versionadded:: 3.9 -.. method:: str.replace(old, new[, count]) +.. method:: str.replace(old, new, count=-1) Return a copy of the string with all occurrences of substring *old* replaced by - *new*. If the optional argument *count* is given, only the first *count* - occurrences are replaced. + *new*. If *count* is given, only the first *count* occurrences are replaced. + If *count* is not specified or ``-1``, then all occurrences are replaced. + + .. versionchanged:: 3.13 + *count* is now supported as a keyword argument. .. method:: str.rfind(sub[, start[, end]]) |