D
D
dontgiveafcuk2018-03-01 14:56:33
Python
dontgiveafcuk, 2018-03-01 14:56:33

How to make the read words from the list read as separate words and not just as a set of characters?

if any(x in status.text.lower() for x in config.search_keywords)

config.search_keywords = ['rt','fav'] ## Список в котором нужно найти совпадения

When searching for these words in status.text, an incorrect result is produced.
Instead of the necessary words, I get words containing these characters, for example. the word Pa rt y

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2018-03-01
@vintello

actually the condition is hammered correctly. if you remove the variables, you will get the correct result, I think the problem is in the values. break it down into simple variables and then you will see what the problem is. possible even with data types

status_low = status.text.lower()
search_keywords = config.search_keywords
if any(x in status_low for x in search_keywords)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question