文本过滤器

def text_filter(msg,censored_word = 'lame',changed_word = 'Awesome'):
    return msg.replace(censored_word,changed_word)

def text_consored_creat(name,msg):
    desk_top_path = 'E:/Users/'
    full_path = desk_top_path +name+'.txt'
    file=open(full_path,'w')

    def text_filter(msg, censored_word='lame', changed_word='Awesome'):
        return msg.replace(censored_word, changed_word)
    file.write(str(text_filter(msg)))
    file.close()
    print('DONE')
print(text_consored_creat('wy','Python is lame'))

你可能感兴趣的:(文本过滤器)