python-redisGet all element from sorted set in Redis
r = redis.Redis()
list = r.zrange('top', 0, -1)ctrl + c| redis.Redisconnect to Redis server | zrangeretrieves sorted set elements based on offset and limit | 
| topname of sorted set in Redis | 0, -1will return all elements from sorted set | 
| listresulting list with elements from sorted set | |
Usage example
import redis
r = redis.Redis()
r.zadd('top', {'Donald': 2})
r.zadd('top', {'Joe': 1})
print(r.zrange('top', 0, -1))output
[b'Joe', b'Donald']
More of Python Redis
- Set Redis charset
- Set expiration (TTL) for Redis key
- Delete keys in Redis by pattern
- Connect to Redis with username and password
- How to use boolean values in Redis
- Connect to Redis using URL
- Redis async await example
- Search keys by pattern in Redis
- Auto reconnect to Redis server
- Redis URI with password example
See more codes...