编程语言
首页 > 编程语言> > python中按照命名顺序读取图片

python中按照命名顺序读取图片

作者:互联网

path = "test1/"
files = os.listdir(path)
files.sort(key=lambda x: int(x.split('.')[0]))
for filename in files:
    print(filename)

标签:files,test1,listdir,顺序,读取,python,filename,path
来源: https://blog.csdn.net/gqqad123/article/details/100083412