Arguments
str
required
The key of the set.
int
How many members to remove and return.
Response
The popped member.
If
count is specified, a set of members is returned.Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
redis.sadd("myset", "one", "two", "three")
assert redis.spop("myset") in {"one", "two", "three"}
redis.sadd("myset", "one", "two", "three")
assert redis.spop("myset", 2) in {"one", "two", "three"}
Removes and returns one or more random members from a set.
count is specified, a set of members is returned.redis.sadd("myset", "one", "two", "three")
assert redis.spop("myset") in {"one", "two", "three"}
redis.sadd("myset", "one", "two", "three")
assert redis.spop("myset", 2) in {"one", "two", "three"}
Was this page helpful?