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

 


 

 

Solution:

方法1:

  string 中的 replace 函数

 

方法2:

1 def censor(text, word):
2     words = text.split(word)
3     return ("*"*len(word)).join(words)

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
  • 2022-12-23
  • 2021-11-08
  • 2022-02-10
  • 2022-02-19
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-18
  • 2021-04-09
  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
  • 2022-01-02
相关资源
相似解决方案