CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
jackfrued

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: jackfrued/Python-100-Days
Path: blob/master/Day01-15/code/Day12/test5.py
Views: 729
1
"""
2
不良内容过滤
3
"""
4
import re
5
6
7
def main():
8
sentence = '你丫是傻叉吗? 我操你大爷的. Fuck you.'
9
purified = re.sub('[操肏艹]|fuck|shit|傻[比屄逼叉缺吊屌]|煞笔',
10
'*', sentence, flags=re.IGNORECASE)
11
print(purified)
12
13
14
if __name__ == '__main__':
15
main()
16
17