Python 字符串关键字过滤

问题:
把给定字符串中的关键字用与关键字等长的“*”串代替。


Solution:

方法1:

  string 中的 replace 函数

方法2:

1 def censor(text, word):
2     words = text.split(word)
3     return ("*"*len(word)).join(words)
原文地址:https://www.cnblogs.com/maples7/p/4492514.html