Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push a whole sequence to redis in Python [duplicate]

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?

like image 940
magicyang Avatar asked Jan 16 '13 12:01

magicyang


1 Answers

You can use this:

Redis.rpush('key', *seq)

More at SO.

like image 188
eumiro Avatar answered Nov 15 '22 12:11

eumiro