1 l2 = [] 2 li = ['顾清秋','懒笨呆'] 3 content = input('请输入内容') 4 for i in li: 5 if i in content: 6 content = content.replace(i,'*'* len(i)) 7 l2.append(content) 8 print(l2)
1 l2 = [] 2 li = ['顾清秋','懒笨呆'] 3 content = input('请输入内容') 4 for i in li: 5 if i in content: 6 content = content.replace(i,'*'* len(i)) 7 l2.append(content) 8 print(l2)