import redis r = redis.Redis(host='192.168.110.252', port=6379, password='Jchl1528', db=1, socket_timeout=5) keys = r.keys('login_tokens:*') print('Total tokens:', len(keys)) typed = 0 plain = 0 for k in keys[:10]: raw = r.get(k) s = raw.decode('utf-8', errors='replace') key_str = k.decode() if s.startswith('["com.'): typed += 1 print(' TYPED: ' + s[:150]) elif s.startswith('{'): plain += 1 print(' PLAIN: ' + s[:150]) else: print(' OTHER: ' + s[:150]) print('Typed:', typed, 'Plain:', plain)