Ask coding questions

← Back to all posts
How do get a list of all the keys in my database?
h
ZoutigeWolf (0)

I have this code to list all the keys:

@bot.command()
async def keys(ctx):
  allkeys = db.keys()
  allkeys_list = list(allkeys)
  await ctx.send(allkeys_list)

but it outputs: <coroutine object Command.call at 0x7fd0a01536c0>
what is this and how do i get a normal list of all my keys?

Answered by IcynDevz (764) [earned 5 cycles]
View Answer
Comments
hotnewtop
IcynDevz (764)

to list all of your keys do

keys = db.keys()
for i in keys: # or whatever variable
  print(i)