Ask coding questions

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

I have this code to list all the keys:

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

but it outputs: <coroutine object 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
IcynDevz (764)

to list all of your keys do

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