#替换文件目录下的文档中的敏感词进行替换
def b():
with open('F:/pyxm/python源代码/test/test0911.txt','r')as f:
text=str(f.readlines())
for chin ['sb','傻逼','傻b','煞笔','煞比','傻B','shabi']:
if chin text:
text =str(text).replace(ch,'*'*len(ch))
print(text)
b()
#替换文件目录下的文档中的敏感词进行替换
def b():
with open('F:/pyxm/python源代码/test/test0911.txt','r')as f:
text=str(f.readlines())
for chin ['sb','傻逼','傻b','煞笔','煞比','傻B','shabi']:
if chin text:
text =str(text).replace(ch,'*'*len(ch))
print(text)
b()
本文标题:十三、对文档中的敏感词进行替换
本文链接:https://www.haomeiwen.com/subject/kqcgyctx.html
网友评论