赞
踩
Mongodb
Redis
Hbase hadoop
Cassandra hadoop
pip install redis
from redis import Redis rs = Redis(host='127.0.0.1',port=6379,db=0,decode_responses=True) #操作数据库 # string常用操作命令 rs.set('name','zs') print(rs.get('name')) rs.mset({'name':'ls','age':18}) print(rs.mget(['name','age'])) rs.append('name','hh') print(rs.mget(['name','age'])) # 健常用操作命令 rs.delete('name') print(rs.exists('name')) rs.expire('age',20) print(rs.ttl('age')) print(rs.type('age')) print(rs.keys('a*')) # hash操作命令 rs.hset('zs','name','zhangsan') print(rs.hget('zs','name')) rs.hmset('zs',{'name':'lisi','age':18}) print(rs.hmget('zs',['name','age'])) print(rs.keys('zs')) print(rs.hvals('zs')) rs.hdel('zs','age') print(rs.keys('zs')) print(rs.hvals('zs'))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。