当您
*values在参数列表中看到语法时,这意味着该函数接受可变数量的参数。
因此,将其称为
r.sadd('a', 1, 2, 3)您可以通过使用splat运算符来传递可迭代对象以对其进行解压缩:
r.sadd('a', *set([3, 4]))要么
r.sadd('a', *[3, 4])
当您
*values在参数列表中看到语法时,这意味着该函数接受可变数量的参数。
因此,将其称为
r.sadd('a', 1, 2, 3)您可以通过使用splat运算符来传递可迭代对象以对其进行解压缩:
r.sadd('a', *set([3, 4]))要么
r.sadd('a', *[3, 4])