Skip to content

Commit 61cd5b7

Browse files
authored
Create 0012.py
1 parent 40aa690 commit 61cd5b7

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

pylyria/0012/0012.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# -*- coding: utf-8 -*-
2+
#!/usr/bin/env python
3+
import re
4+
5+
def sensitive_test(word):
6+
sensitive_words = [line.strip() for line in open('sensitive.txt', encoding='utf-8')]
7+
word = word.strip()
8+
for sensitive_word in sensitive_words:
9+
if sensitive_word.strip() in word.lower():
10+
word = re.sub(sensitive_word, '*' * len(sensitive_word), word, flags=re.IGNORECASE)
11+
return word
12+
13+
if __name__ == "__main__":
14+
line = True
15+
while line:
16+
line = input()
17+
line = line.strip()
18+
print(sensitive_test(line))

0 commit comments

Comments
 (0)