How to use sadd with multiple elements in Redis using Python API?
When you see the syntax *values
in an argument list, it means the function takes a variable number of arguments.
Therefore, call it as
r.sadd('a', 1, 2, 3)
You can pass an iterable by using the splat operator to unpack it:
r.sadd('a', *set([3, 4]))
or
r.sadd('a', *[3, 4])
Consider the following:
r.sadd('a', 1, 2, 3)
That should do the trick.