jpgpath = glob.glob("D:\\test1\\*.jpg") jpgfiles = [] for jpgfile in jpgpath: jpgfiles += jpgfile[:-4] print (jpgfiles)
Вот что он мне выдает:
D:\Proj\Kolya_img\Gmail>999.py ['D', ':', '\\', 't', 'e', 's', 't', '1', '\\', '1', '7', '.', 'j', 'p', 'g', 'D ', ':', '\\', 't', 'e', 's', 't', '1', '\\', 'K', 'A', 'N', 'O', 'P', 'U', 'S', '_', 'P', 'S', 'S', '_', '9', '1', '3', '_', '1', '_', '7', '.', 'j', 'p', 'g']