创建redis连接池
import redis
def create_redis_pool():
REDIS_DB = '127.0.0.1'
REDIS_PORT = 6379
pool = redis.ConnectionPool(host=REDIS_DB, port=REDIS_PORT, max_connections=1024)
conn = redis.Redis(connection_pool=pool)
print('创建redis连接池成功')
return conn
conn = create_redis_pool()
print(len(conn.smembers('all_urls')))
list1 = [i.decode().split('-')[-1] for i in conn.smembers('all_urls')]
print(list1)