python中redis获得到的值是带b'**'


原因在于在python中从Redis取出的Sting都变成bytes格式

解决一

# 加上decode_responses=True即可解决

redis_store = redis.StrictRedis(host='127.0.0.1', port=6379, decode_responses=True)

解决二

取值时后面加上decode()

redis_store.get("name:%s"%name).decode()

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM