Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/352.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 可以在discord.py命令中传递多个参数吗?_Python_List_Discord.py - Fatal编程技术网

Python 可以在discord.py命令中传递多个参数吗?

Python 可以在discord.py命令中传递多个参数吗?,python,list,discord.py,Python,List,Discord.py,我想要的是将一个列表传递到一个函数中,但由于某种原因,我总是得到一个错误 例如: L=["Hello"] @client.command() async def enroll(ctx, L: list): #processing await ctx.channel.send(L) 让它接受一个字符串,然后使用str.split将其解析为一个列表 然后传递一个由逗号分隔的字符串: [p]enroll thing1,thing2 在我看来,您设置了变量L,然后定义了一个函数,可以

我想要的是将一个列表传递到一个函数中,但由于某种原因,我总是得到一个错误

例如:

L=["Hello"]
@client.command()
async def enroll(ctx, L: list):
    #processing
    await ctx.channel.send(L)

让它接受一个字符串,然后使用str.split将其解析为一个列表

然后传递一个由逗号分隔的字符串:

[p]enroll thing1,thing2

在我看来,您设置了变量L,然后定义了一个函数,可以将列表作为参数。但是您没有显示如何调用函数和传递列表。您需要在代码中的某个地方调用它,如EnrollPlease,请指定您得到的错误
[p]enroll thing1,thing2