python-redisAdd element to the list in Redis
r = redis.Redis()
r.lpush('list', 'value')ctrl + c| redis.Redisconnect to Redis server | lpushpushes specified element to the beginning of the list | 
| listname of the list to add element to | valuevalue of the new element to add to the list | 
Usage example
import redis
r = redis.Redis()
r.lpush('list', 2)
print(r.lrange('list', 0, -1))output
[b'2', b'1']
Related
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
- Search keys by pattern in Redis
- Redis async await example
- Save JSON to Redis
- Redis URI with password example
See more codes...