How to check the word



  • I'm writing a bot on my Vk account. There was a need to check reports for proscribed words, such as the prohibited word Arbuz, a proposal that needed to be found: I love the watermelon.



  • bad_words = ['арбуз']
    message = 'Я люблю арбуз'
    
    for word in message.lower().split():
        if word in bad_words:
            print('Обнаружено плохое слово!')
            break
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2