敏感词文本文件 filtered

    技术2023-12-28  92

    def recode(): with open('a.txt', 'rb') as f: word = f.readlines() t = input('> ') # 输入需识别的文字 for i in word: a = i.decode('utf-8').strip() # 转化为unicode if a in t: # 如果文字中含有敏感词 b = str(t).replace(a, '*') # 将敏感词替换为* t = b # 被替换后的文字 print(t) recode()
    Processed: 0.012, SQL: 9