# 获取文件夹下文件的名称集合
path = 'pic/'
fns = [os.path.join(root,fn) for root, dirs, files in os.walk(path) for fn in files]
redis_obj = RedisOpt(redis_db=0)
img_path_list = [img_path.replace('\\\\', '/').replace('\\','/') for img_path in fns]
for img_path in img_path_list:
print(img_path)
redis_obj.add_set_data(key='pic_local_path', data=img_path)
将一个文件夹下的所有图片的相对路径存入redis
最新推荐文章于 2020-09-04 10:02:51 发布