我正在加载 700 张图像,我需要它们按照名称的顺序排列(_DCS6825_01、_DCS6825_02...),但是当尝试这样做时,在图像 _DCS6825_10 之后,下一个要加载的是图像 _DCS6825_100,然后是 _DCS6825_101图片 11(_DCS6825_11),我该如何解决。这是我的代码:
from PIL import Image
import glob
import matplotlib.pyplot as plt
import os
path = r'C:\Users\juanc\Desktop\prueba origen\restich\\'
image_list = []
for filename in glob.glob(path+'*.jpg'):
im=Image.open(filename)
image_list.append(im)
sortedlist = sorted(image_list)
print(sortedlist)
排序产生错误:
TypeError: '<' not supported between instances of 'JpegImageFile' and 'JpegImageFile'
谢谢您的帮助
忽然笑
幕布斯7119047
随时随地看视频慕课网APP
相关分类