这是我的代码
amount = 0
list = []
#b is the client
@b.command()
async def hello(ctx):
if list == []:
list.append("9")
list.append("10")
list.append("11")
list.append("12")
else:
amount += 1
print(list[amount])
因此,有几件事我想做,每次我通过不和谐运行命令时,我都希望它加1,我也希望将我在命令中附加的内容永久添加到列表中,因为这些值会每次我运行命令时都要更改。
这是我要打印的示例:
运行一次之后:
9
在我运行两次之后:
10
我跑了三遍之后:
11
这样的东西?(dis.py问题必定可以立即进行测试)
lst = []
#b is the client
@b.command()
async def hello(ctx):
if not lst:
lst.append(9)
else:
last = lst[-1]
await ctx.send(last)
lst.append(last + 1)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句