import redis host = 'xxxxx' port = 6379 db_data = 10 redis_data= redis.Redis(host=host, port=port,db=db_data, password=password,decode_responses=True) callernumber=“18812345678” speaker="home" message="早啊" obj={"speaker":speaker,"message":message} obj = json.dumps(obj) redis_data.rpush(callernumber, obj) # 缓存记录对话信息