When I try to get members of a set using python smembers function it is always returning shuffled data. And every call to smembers returns random data. However when I do a smembers through redis cli, it always returns correct sorted data from that set.
print(redis_con.smembers('alpha'))
2
Answers
redis-py
returns a Python set which is per default unordered:You would need to sort the set yourself:
Redis set is unordered, so the result of
smembers
are NOT sorted. That’s a expected behavior. If you want to have sorted result, you need to sort it manually.