Python3的字符串替换,这里总结了三个函数,replace()和translate()和re.sub() replace() replace() 方法把字符串中的 old(旧字符串) 替换成 new(新字符串),如果指定第三个参数max,则替换不超过 max 次 str.replace(old, new[, max]) a = 'Hello,world. ByeBye!' print(a.replace('l','Q')) print(a.replace('abcdefghi','01234…