假设我有一个变量 a,其中有一个列表,它看起来像这样:
a = ['hello', 'there']
Run Code Online (Sandbox Code Playgroud)
我想解压列表,但我不想使用 for 循环,但我只是不知道如何使其工作。我试过了:
def unpack(table):
for i in table:
return i
a = ['hello', 'there']
print(unpack(a))
Run Code Online (Sandbox Code Playgroud)
我想要打印它
hello, there
Run Code Online (Sandbox Code Playgroud)
但它只打印 hello 有人可以帮我吗?
但它只返回你好
python ×1