J
J
James_Obry2021-07-03 12:30:52
Python
James_Obry, 2021-07-03 12:30:52

How to get only numbers from an array?

The bottom line is this, I pull out id numbers from the SQlite3 database that are added to my array, and I need separate numbers, please tell me how this can be done?
Here is the code:

searching_object = f"{message.text}"
    cur.execute(f"SELECT id FROM ads WHERE feature1 = '%s'" % searching_object)
    result = cur.fetchall()
    print(result) # Результат: [(3,), (4,), (5,)]<code lang="python">

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2021-07-03
@James_Obry

result = [i[0] for i in cur.fetchall()]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question