安装redis-py
读写数据:
import redis r=redis.StrictRedis(host=‘192.168.*.*‘,port=6379,db=0) r.hset("person:1", "name", "zhangsan") print(r.hget("person:1", "name"))#b‘zhangsan‘ pipe=r.pipeline() pipe.set("a","A") pipe.get("a") result=pipe.execute() print(result)#[True, b‘A‘]
时间: 2024-10-09 14:06:42