Home > database >  Python for help, in the most simple way, just began to learn, ask for help for help, is about to han
Python for help, in the most simple way, just began to learn, ask for help for help, is about to han

Time:10-29

Note: in network applications, such as chat room, chat software, etc., often need to some sensitive words in the chat user submitted content filtering,
# as "sex", "sex", "bang", "terrorist", "gun", "arms" and so on, all of these can not be spread on the Internet, need to filter out or in other words,

CodePudding user response:

Get a good filter list ah, again to look for a person to provide code?

CodePudding user response:

reference 1st floor SuperDay response:
to get a good filter list ah, again to look for a person to provide code?

Need a simple code process, it is a job

CodePudding user response:

refer to the second floor weixin_45678050 response:
Quote: refer to 1st floor SuperDay response:
to get a good filter list ah, again to look for a person to provide code?

Need a simple code process, it is a job
do ah

CodePudding user response:

reference SuperDay reply: 3/f
Quote: refer to the second floor weixin_45678050 response:
Quote: refer to 1st floor SuperDay response:
to get a good filter list ah, again to look for a person to provide code?

Need a simple code process, it is a job
do ah

I don't know how to make filter list

CodePudding user response:

Weixin_45678050
reference 4 floor response:
Quote: refer to the third floor SuperDay response:
Quote: refer to the second floor weixin_45678050 response:
Quote: refer to 1st floor SuperDay response:
to get a good filter list ah, again to look for a person to provide code?

Need a simple code process, it is a job
do ah

I don't know how to make filter list
it is good to make a list

CodePudding user response:

A regular, replace all * * *

CodePudding user response:

 the from functools import reduce 
Filter=(' sex ', 'sex', 'bang', 'terrorists' and' gun ', 'arms')
MSG='this is a terrorist cannot have such news'
Reduce (lambda m, f: m.r eplace (f, '* *'), (MSG) + filter)
  • Related