About char b prefix in Python3.4.1 client connect to redis

前端 未结 2 670
忘了有多久
忘了有多久 2020-12-02 22:35

I am run into trouble .My code below.But I do not know why there is a char \'b\' before output string \"Hello Python\".

>>> import redis
>>>         


        
2条回答
  •  醉话见心
    2020-12-02 23:11

    It means it's a byte string

    You can use:

    redis.StrictRedis(host="localhost", port=6379, charset="utf-8", decode_responses=True)
    

    using decode_responses=True to make a unicode string.

提交回复
热议问题