W
W
WiF Azapro2022-02-24 15:26:02
Python
WiF Azapro, 2022-02-24 15:26:02

How to get data from sqlite table?

My code:

@bot.command()
async def balls(ctx, userID=None):
if userID == None:
  balls = cursor.execute(f"""
    SELECT balls
    FROM balls
    WHERE id = {ctx.message.author.id};
  """)
  await ctx.send(f"У тебя {balls}Б")
else:
  balls = cursor.execute(f"""
    SELECT balls
    FROM balls
    WHERE id = {userID};
  """)
  await ctx.send(f"У {userID} {balls}Б")


Conclusion:

У тебя <sqlite3.Cursor object at 0x7f644b7af6c0>Б
У 930093253917802546 <sqlite3.Cursor object at 0x7f644b7af6c0>Б

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Nesterov, 2022-02-24
@Azapro_html

1. For f-sides for requests in a decent society they beat in the face
2. fetchone / fetchall for whom did they come up with?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question