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()
转载请注明原文地址:https://ipadbbs.8miu.com/read-46966.html