封装redis import redis # r = redis.Redis() class MyRedis(): def __init__(self,ip,password,port=6379,db=0): #构造函数 try: self.r = redis.Redis(host=ip,password=password,port=port,db=db) except Exception as e: print('redis连接失败,错误信息%s'%e) def str_get(self,k)…