pip install redis
基本操作
#encoding=utf-8
import redis
#链接redis数据库
r = redis.Redis(host = 'localhost', port = 6379, db = 0)
#往redis中写数据
r.set('nvshen', 'hehe')
r['diaosi'] = 'yy'
r.set('xueba', 'xuexi')
r['xuezha'] = 'wan'
#查看对应的值
prin

本文档介绍了使用Python2.7与Redis进行交互的基本步骤和常见操作,包括连接建立、键值存取、数据类型操作及关闭连接等。
最低0.47元/天 解锁文章
3143

被折叠的 条评论
为什么被折叠?



