python - How to program the refactored version of my code? -


i received answer how refactor code @ codereview.

https://codereview.stackexchange.com/questions/90378/how-should-i-refactor-my-insert-class/90385#90385

but when try code ide issues error: unresolved reference w , ']' expected. wrong code? i'm still learning python i'm not sure error is, might typo.

bad_words = ['penis', 'black money', 'escort']  if any[w in text or w.upper() in text or w.capitalize() in text        w in bad_words]:     self.response.out.write('removed')     return 

first need parentheses function call. secondly, can reduce code following:

any(w.lower() in text.lower().split() w in bad_words) 

Comments

Popular posts from this blog

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -