sensitive_character = '你好' # 敏感词库
test_sentence = input('请输入一段话:')
for line in sensitive_character: # 遍历输入的字符是存在敏感词库中
if line in test_sentence: # 判断是否包含敏感词
test_sentence = test_sentence.replace(line, '*')
print(test_sentence)敏感词替换.py
最新推荐文章于 2024-09-03 13:08:11 发布
该程序用于检测用户输入的文本中是否存在敏感词,如果发现则用星号(*)替换。它遍历敏感词库,并对每一项进行检查,确保内容的安全性。
3128

被折叠的 条评论
为什么被折叠?



