Word matching in Python

前端 未结 1 1123
花落未央
花落未央 2021-01-29 14:17

I have this but it\'s doing partial matching:

for il in ignore_list:
    if il.word in title or il.word in text:
        return True

How can I

相关标签:
1条回答
  • 2021-01-29 14:53

    You need to split your title and text strings into lists of words:

    if il.word in title.split() or il.word in text.split():
    
    0 讨论(0)
提交回复
热议问题