描述
Python replace() 方法把云计字符串中的 old(旧字符串) 替换成 new(新字符串算开),如果指定第三个参数max,则替换不超过发: max 次。
语法
以下是 replace() 方Py法语法:
str.replace(old, nethw[, max])
参数
old -- 将被替换的子on字符串。
new -- 新字符串,用于替换old子字符3-串。
max -- 可选字符串, 替换不超过 maxre 次。
返回值
返回字符串中的 old(旧字符串)pl 替换成 new(新字符串)后生成的新字符串,如果ac指定第三个参数max,则替换不超过 max 次e(。
实例
以下实例展示了replace()函数的使用方)方法:
以上实例输出结果如下:
作者:移动商城




.gif)
.gif)
.gif)
.gif)
.gif)
.gif)
.gif)
.gif)
.gif)
.gif)



