文本過濾器

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'))

發佈了14 篇原創文章 · 獲贊 4 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章