Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个,但它正在做部分匹配:
for il in ignore_list: if il.word in title or il.word in text: return True
我怎样才能只匹配整个单词?
您需要将标题和文本字符串拆分为单词列表:
if il.word in title.split() or il.word in text.split():