redis.rpush("mylist", "one", "two", "three")

assert redis.lrange("mylist", 0, 1) == ["one", "two"]

assert redis.lrange("mylist", 0, -1) == ["one", "two", "three"]

Arguments

key
str
required
The key of the list.
start
int
required
The starting index of the range to return.Use negative numbers to specify offsets starting at the end of the list.
end
int
required
The ending index of the range to return.Use negative numbers to specify offsets starting at the end of the list.

Response

The list of elements in the specified range.
redis.rpush("mylist", "one", "two", "three")

assert redis.lrange("mylist", 0, 1) == ["one", "two"]

assert redis.lrange("mylist", 0, -1) == ["one", "two", "three"]