How to remove items in a sorted set using python i

2019-07-18 05:44发布

How to I removed items in a sorted set greater than a value using python?

key = 'foo'
pipe = redis_master_conn.pipeline()
pipe.zadd(key,1,'a')
pipe.zadd(key,2,'b')
pipe.zadd(key,3,'c')
pipe.zadd(key,4,'d')
pipe.zadd(key,5,'e')
pipe.execute()

redis_master_conn.zremrangebyscore('foo',4,'+inf') 

Below is the result

zrange foo 0 -1
1) "a"
2) "b"
3) "c"
4) "d"
5) "e"

The above did not work. Nothing was removed

标签: python redis
0条回答
登录 后发表回答