いくつかの値を別のデータベースに書き込みたいのですが、これが私のコードです:
import redis
r1 = redis.Redis(host='127.0.0.1', port=6379, db = 'db1')
r2 = redis.Redis(host='127.0.0.1', port=6379, db = 'db2')
numList = ['4', '3', '2', '1']
for num in numList:
r1.lpush('a', num)
r2.lpush('a', 'test')
print r1.lrange('a',start=0,end=-1)
print r2.lrange('a',start=0,end=-1)
それから私はこの結果を得ました:
['test', '1', 'test', '2', 'test', '3', 'test', '4']
['test', '1', 'test', '2', 'test', '3', 'test', '4']
私は別のデータベースを使用していますが、同じキーに対して、すべての値が入力されています。ありがとうございます。