Python 字符串关键字过滤时间:2023-03-10 02:31:48 问题:把给定字符串中的关键字用与关键字等长的“*”串代替。 Solution: 方法1: string 中的 replace 函数 方法2: def censor(text, word): words = text.split(word) return ("*"*len(word)).join(words)