题解 | #修正错误的字母#
修正错误的字母
https://www.nowcoder.com/practice/efc02a6e769a4dc3b1433a36109c9217
a=input()
b=a.replace('a*','ab')
print(b)
# Python replace() 方法把字符串中的 old(旧字符串) 替换成 new(新字符串),如果指定第三个参数max,则替换不超过 max 次。
str = "this is string example....wow!!! this is really string";
print str.replace("is", "was");
print str.replace("is", "was", 3);
#输出:thwas was string example....wow!!! thwas was really string
thwas was string example....wow!!! thwas is really string
腾讯成长空间 5970人发布