Answer the question
In order to leave comments, you need to log in
How to fix error with getting sql data in python?
my code:
a = "Ваш баланс: " + str(sql.execute(f"SELECT money from users WHERE id = '{user_id}'")) + "$"
print(a)
Ваш баланс <sqlite3.Cursor object at 0x000001FBCA70AD50>$
Answer the question
In order to leave comments, you need to log in
First of all, this is not a mistake. Secondly, execute in python, like in any other language, returns a fetch object. To pull information from there, you need to use the .fetchall () function.
For example:
cur.execute("SELECT * FROM table")
rows = cur.fetchall()
for row in rows:
print(row)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question