From 01a560c6dc5dd699365cffabce1f60da7e188b1a Mon Sep 17 00:00:00 2001 From: liaozetao <1107136310@qq.com> Date: Thu, 26 Oct 2023 09:21:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=BA=E5=AE=9D=E6=A6=9C?= =?UTF-8?q?=E5=8D=95=E5=AF=BC=E5=87=BA=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/peko_seize_treasure_rank_value.py | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 python/peko_seize_treasure_rank_value.py diff --git a/python/peko_seize_treasure_rank_value.py b/python/peko_seize_treasure_rank_value.py new file mode 100644 index 000000000..775b50bbe --- /dev/null +++ b/python/peko_seize_treasure_rank_value.py @@ -0,0 +1,31 @@ +# pip3 install redis + +import redis +import json +from concurrent.futures import ThreadPoolExecutor + +res = None + +def connect(): + res = redis.StrictRedis(host='172.22.0.8', port=6379, db=0, password='pc8DphhaXwTe2jyv') + return res + + +def handle_keys(): + try: + members = res.zrange('peko:seize_treasure:rank:value:2023-10-24', 0, -1, withscores=True) + for m in members: + uid = m[0].decode('utf-8') + score = m[1] + print(uid, ',', score) + except Exception as e: + print("handle_keys error.", e) + + +if __name__ == '__main__': + res = connect() + if res is None: + print("redis connect is error.") + else: + print("redis connect is success.") + handle_keys()