1.存数据
# 连接redis, 指定库(0-15) r = redis.StrictRedis(host='localhost', port=6379, db=0) result_list = [1, 2, 3] for result in result_list: # 指定表名,存数据 r.sadd('school_url1', result)
2.取数据
# 取出的同时,删除 r_result = r.spop('school_url1')
1.存数据
# 连接redis, 指定库(0-15) r = redis.StrictRedis(host='localhost', port=6379, db=0) result_list = [1, 2, 3] for result in result_list: # 指定表名,存数据 r.sadd('school_url1', result)
2.取数据
# 取出的同时,删除 r_result = r.spop('school_url1')