2021年1月20日星期三

Is there any way to make an user id as a key in a python dictionary with discord.py?

I'm trying to set a variable separated from each user, for example: User a: money: 400 User b: money: 300

But I'm trying to make the User a User b thingy the user id, I've already tried

data[str(message.author.id)]['money'] = 300  print[str(message.author.id)]['money']  

But I got an error: "KeyError: {my user id}"

https://stackoverflow.com/questions/65820190/is-there-any-way-to-make-an-user-id-as-a-key-in-a-python-dictionary-with-discord January 21, 2021 at 09:59AM

没有评论:

发表评论