Python-redis keys() returns list of bytes objects instead of strings

前端 未结 4 1611
孤独总比滥情好
孤独总比滥情好 2021-02-01 14:37

I\'m using the regular redis package in order to connect my Python code to my Redis server.

As part of my code I check if a string object is existed in my R

4条回答
  •  情歌与酒
    2021-02-01 14:53

    If you do not wish to iterate the list for decoding, set your redis connection to automagically perform the decode and you'll receive your required result. As follows in your connection string, please notice the decode_responses argument:

    rdb = redis.StrictRedis(host="localhost", port=6379, db=0, decode_responses=True)
    

    Happy Coding! :-) (revised 13 Nov 2019)

提交回复
热议问题