C
C
ch1ps012022-03-24 21:48:44
SQLite
ch1ps01, 2022-03-24 21:48:44

Problem with fetchall() sqlite3. How to decide?

con=sqlite3.connect('users.db')
    cur=con.cursor()

    cur.execute("SELECT * FROM reviews")
    res=cur.fetchall()
    bot.send_message(message.chat.id, res)


In general ... In the database in the feedback table there are names and text, that is, the name of the person who left the review and the text itself, when displaying everything using fetchall via print, then all names, text are displayed on the command line, only if I I display all this in the bot's chat via bot.send.message, then the bot sends only the first name from the database, no more texts and names, only the first name, how is this fixed? Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
i3a4em, 2022-03-24
@ch1ps01

Your res data type is tuple.
Convert to str and it will work as it should
, at least like this
bot.send_message(message.chat.id, repr(res))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question