从字符串中去除某个字符

def strip_str(stripstr,text):
    '''
    给定的字符串去除特定的字符
    :param stripstr:   要去除字段
    :param text:  原文
    :return:
    '''
    new_str=None
    if stripstr in text:
        new_str=text.replace(stripstr,"")
        if stripstr in new_str:
            return strip_str(stripstr,new_str)
    return new_str
原文地址:https://www.cnblogs.com/longyi2020/p/14579002.html