从不同文件夹读取.png图片并保存到一个文件夹下
import os from glob import glob from PIL import Image path = './' for i in range(4): path_ = path+ str(i+1) file_list = glob(os.path.join(path_,'*.png')) # print(file_list[0]) img = Image.open(file_list[0]) s = file_list[0].split('/')[-1] # print(s) path_s = path+'rr/'+s img.save(path_s)