Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
427 B
1
Indexable
Never
import redis

try:
    conn = redis.StrictRedis(host='localhost', port=6379)
    print(conn)
    conn.ping()
    print('Connected!')
except Exception as ex:
    print('Error:', ex)
    exit('Failed to connect, terminating.')

user = {"Name":"Pradeep", "Company":"SCTL", "Address":"Mumbai", "Location":"RCP"}

for i in range(0,10):
    print(i)
    conn.hmset("pythonDict_{}".format(i), user)


print(conn.hgetall("pythonDict"))