Arguments
str
required
The key of the list.
number
required
How many occurrences of the element to remove.
Any
required
The element to remove
Response
The number of elements removed.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
redis.rpush("mylist", "one", "two", "three", "two", "one")
assert redis.lrem("mylist", 2, "two") == 2
assert redis.lrange("mylist", 0, -1) == ["one", "three", "one"]
Remove the first count occurrences of an element from a list.
redis.rpush("mylist", "one", "two", "three", "two", "one")
assert redis.lrem("mylist", 2, "two") == 2
assert redis.lrange("mylist", 0, -1) == ["one", "three", "one"]
Was this page helpful?