P
P
PosikGG2021-08-17 11:47:40
Python
PosikGG, 2021-08-17 11:47:40

How can I make the left constant be a list?

Here is the usual code that is executed: But if you put it like this: Then the code will give an error. But. If you leave the first option, then, let's say the user sent a message "thank you", the bot will not respond, because. does not know such a command.

if message.text.upper() in config.lst_4

if config.lst_4 in message.text.upper()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
o5a, 2021-08-17
@PosikGG

if any(word in message.text.upper() for word in config.lst_4):

You can use regexp if you need a more accurate selection (for example, take into account only full words or not, etc.).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question