import redis
host = xxx
pwd = xxx
r = redis.Redis(host=host,password=pwd,db=15,decode_responses=True,port=xxxx)
r.hmset('test',{'xxxxxx65': "{'QQ号': xxxxx65}"}) #写入redis
print(r.hgetall('test'))
#上述代码的执行结果:
{'xxxxxx65': "{'QQ号': xxxxx65}"}
#需要注意:
字典里value左右两边是 双引号,即value是个 字符串,非字典嵌套。