2020
10-08
10-08
python redis存入字典序列化存储教程
在python中通过redishset存储字典时,必须主动把字典通过json.dumps()序列化为字符串后再存储,不然hget获取后将无法通过json.loads()反序列化为字典序列化存储r=redis_conn()r.hset('wait_task','one',json.dumps({'project':'india','total_size':'15.8MB'}))r.hset('wait_task','two',json.dumps({'project':'india','total_size':'15.8MB'}))r.hset('wait_task','three',json.dumps({'project':'india',...
继续阅读 >