Redis: How to parse a list result

前端 未结 3 382
不思量自难忘°
不思量自难忘° 2020-12-29 04:03

I am storing a list in Redis like this:

redis.lpush(\'foo\', [1,2,3,4,5,6,7,8,9])

And then I get the list back like this:

r         


        
3条回答
  •  南笙
    南笙 (楼主)
    2020-12-29 04:43

    import json
    r = [b'[1, 2, 3, 4, 5, 6, 7, 8, 9]']
    rstr = r[0]
    res_list = json.loads(rstr)
    

提交回复
热议问题