mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue5416 - Revert a documentatin change made to explain replace on negative value.
Minor changes to doc: s/maxsplit/maxreplace
This commit is contained in:
parent
011a82b1c4
commit
a240cb1f2d
1 changed files with 5 additions and 6 deletions
|
@ -508,16 +508,15 @@ def capitalize(s):
|
||||||
return s.capitalize()
|
return s.capitalize()
|
||||||
|
|
||||||
# Substring replacement (global)
|
# Substring replacement (global)
|
||||||
def replace(s, old, new, maxsplit=-1):
|
def replace(s, old, new, maxreplace=-1):
|
||||||
"""replace (str, old, new[, maxsplit]) -> string
|
"""replace (str, old, new[, maxreplace]) -> string
|
||||||
|
|
||||||
Return a copy of string str with all occurrences of substring
|
Return a copy of string str with all occurrences of substring
|
||||||
old replaced by new. If the optional argument maxsplit is
|
old replaced by new. If the optional argument maxreplace is
|
||||||
given, only the first maxsplit occurrences are replaced. A
|
given, only the first maxreplace occurrences are replaced.
|
||||||
negative value of maxsplit signifies all occurances.
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return s.replace(old, new, maxsplit)
|
return s.replace(old, new, maxreplace)
|
||||||
|
|
||||||
|
|
||||||
# Try importing optional built-in module "strop" -- if it exists,
|
# Try importing optional built-in module "strop" -- if it exists,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue