import redis redis_ip = '10.10.14.224' redis_port = 18890 # 配置redis的连接办法 # http://blog.csdn.net/u010472499/article/details/78022533 pool = redis.ConnectionPool(host=redis_ip, port=redis_port) r = redis.Redis(connection_pool=pool) count = 0 for key in r.scan_iter(match='login_*', count=10000): count = count + 1 print('进入' + str(count) + '次,' + str(key, encoding='utf-8')) # r.delete(key)