How to push a whole sequence to redis in Python [d

2019-04-26 21:50发布

This question already has an answer here:

I can use Redis.rpush('key', 1, 2, 3) to push three elements to redis, but if there is a sequence:

seq = [1, 2, 3]

Redis.rpush('key', seq)

It will push a 'seq' element to redis but not the three number. Is there any way I can push the whole sequence to redis?

1条回答
Ridiculous、
2楼-- · 2019-04-26 22:31

You can use this:

Redis.rpush('key', *seq)

More at SO.

查看更多
登录 后发表回答