十三、对文档中的敏感词进行替换
2019-10-17 本文已影响0人
石角斗
#替换文件目录下的文档中的敏感词进行替换
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()