A
A
artemk1ter2021-09-06 17:17:53
Python
artemk1ter, 2021-09-06 17:17:53

How to search a list in the database?

In VK api there is a variable event.message.text, which is equal to the user's message (in this case, 'hello boyar'). I'm splitting this message by spaces, making it a list: ['hello', 'botyara'] There are rows in my database: botyara bot Actually, I need to check if there is a row from the list in the database (sqlite3) via if and issue a response. How can this be done? (If possible, you need to check if there are several similar lines)
event.message.text.split(' ')





Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-09-06
@Vindicar

sqlite supports the IN operator, you can try using it. But that's only good for exact matches.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question