问题:
把给定字符串中的关键字用与关键字等长的“*”串代替。
Solution:
方法1:
string 中的 replace 函数
方法2:
1
def
censor(text, word):
2 words = text.split(word)
3return ("*"*len(word)).join(words)
原文:http://www.cnblogs.com/maples7/p/4492514.html
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!