一、为Python安装Redis库
- https://github.com/andymccurdy/redis-py 后点击Download ZIP下载安装包
- 解压安装包redis-py-master.zip
- 安装
cd redis-py-master
python setup.py install
二、python 文件
假设redis的key值为 h1,h2,,,,一直到h63
import redis
pool = redis.ConnectionPool(host='10.102.36.12', port=8567, decode_responses=True)
conn = redis.Redis(connection_pool=pool)
for i in range (1,64):
key="h"+str(i)
#print(conn.get(key))
conn.delete(key)
print(conn.get(key))
网友评论