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('Login tokens:', len(keys)) for k in keys: raw = r.get(k) s = raw.decode('utf-8', errors='replace') key_str = k.decode() if s.startswith('["com.'): print(' ' + key_str[:40] + ' => TYPED format (OK)') elif s.startswith('{'): print(' ' + key_str[:40] + ' => PLAIN format (old)') else: print(' ' + key_str[:40] + ' => ' + s[:100])