#-*- coding: utf8 -*- import redis pool = redis.ConnectionPool() r = redis.Redis(connection_pool=pool) # 增加操作 r.lpush("stu","zhangsan","lisi","wangwu") print(r.lrange("stu",0,-1)) # [b'wangwu', b'lisi', b'zhangsan', b'zhangsan', b'zhangsan'] # 移除操作 r.ltrim("stu",0,2) print(r.lrange("stu",0,-1)) # [b'wangwu', b'lisi', b'zhangsan']