In redis-cli, what is the command to print all the values in a list without knowing in advance the size of the list? I see lrange
, but it requires naming the start index and the end index.
Asked
Active
Viewed 2.1k times
28

Arun Karunagath
- 1,593
- 10
- 24

einnocent
- 3,567
- 4
- 32
- 42
-
Note mods: this post needs the tag `redis-cli` – einnocent Dec 29 '13 at 20:33
-
`redis-cli` is a new tag ... is it really needed to differentiate between `redis` and `redis-cli`? – d-_-b Jan 01 '14 at 00:32
2 Answers
0
Here's how I did it with python:
import redis
r_server = redis.Redis()
for num in "one", "two", "three", "four", "five":
r_server.rpush("nums", num)
length = r_server.llen("nums")
for x in range(0,length):
print(str(r_server.lindex("nums",x)))
b'one'
b'two'
b'three'
b'four'
b'five'

ajhowey
- 41
- 4