9951 explained code solutions for 126 technologies


python-redisSave dict to Redis


We'll use Redis hash structure to save dicts:

dict = {'name': 'Donald', 'age': 102}

r = redis.Redis()
r.hmset('dict', dict)ctrl + c
dict =

sample dict to save to Redis

redis.Redis

connect to Redis server

hmset

saves specified dict to Redis hash

'dict'

name of the Redis hash to save dict to