![[Python]过滤脏话,第1张 [Python]过滤脏话,第1张](/aiimages/%5BPython%5D%E8%BF%87%E6%BB%A4%E8%84%8F%E8%AF%9D.png)
直接上代码↓
from os import readf='./Obscenity.txt'with open(f,'r') as fi: l=fi.read().splitlines() fi.close()chat=str(input("请输入内容:"))for i in range(len(l)): position=chat.find(l[i]) if position==-1: continue else: c=len(l[i]) chat=chat[0:position]+'*'*c+chat[position+c:len(chat)]print(chat)然后那个.txt文件是这个内容↓
fuckcnmntmdnmwocrnm *** 你妈草泥马你他妈你tm *** 记得这两个文件要放在同一目录下
总结以上是内存溢出为你收集整理的[Python]过滤脏话全部内容,希望文章能够帮你解决[Python]过滤脏话所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)