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