从左到右替换 python

def rreplace(string,str,new_str,max=1):
    string=string[::-1]
    str=str[::-1]
    new_str=new_str[::-1]
    return string.replace(str,new_str,max)[::-1]

原文地址:https://www.cnblogs.com/demiao/p/13408782.html