Python-* args和** kwargs是什么意思?
发布于 2021-02-02 23:19:29
究竟什么*args
和**kwargs
意味着什么?
根据Python文档,从表面上看,它传入了一个参数元组。
def foo(hello, *args):
print hello
for each in args:
print each
if __name__ == '__main__':
foo("LOVE", ["lol", "lololol"])
打印输出:
LOVE
['lol', 'lololol']
您如何有效地使用它们?
关注者
0
被浏览
99
1 个回答