redis,string 数据类型,取出来为字节型,需要转化为str类型:
# bytes object
b = b"example"
# str object
s = "example"
# str to bytes 字符串类型转成bytes类型
bytes(s, encoding = "utf8")
# bytes to str bytes类型转成字符串类型
str(b, encoding = "utf-8")
# an alternative method 方法
# str to bytes
str.encode(s)
# bytes to str
bytes.decode(b)