redis数据换库代码

# coding=utf-8
from utils.redis_util import RedisHelper

key = "master_insight"

redishelper_pro = RedisHelper(redis_mode="redis_pro").conn



count = 0
redishelper_dev = RedisHelper(redis_mode="redis_dev").conn
values = redishelper_dev.smembers(key)
with open("./id_list.txt", "w", encoding="utf-8") as f:
    for value in values:
        print(value)
        count += 1
         f.write(value + "\n")
print(count)


with open("./id_list.txt", "r") as g:
    for j in g.readlines():
        v = j.strip("\n")
        redishelper_pro.sadd(key, v)

你可能感兴趣的:(redis,redis,java,数据库)