我只想使用Python
读取文件夹中的文件名;代码运行正常,只是有一点混乱。文件名的显示顺序与文件夹中的顺序不同。
表示显示所有文件名,但不按顺序显示
文件顺序为(1_F,11_F,12_F,18_M,20_M)
它正在显示(11_F,12_F,18_M)
import glob
image=[]
index=0
for image in glob.glob('D://python_data//interface//images//preprocessed//cm_finaltesting//*.jpg'):
print(image)
输出
runfile('D:/python_data/interface/images/predict_detect_wdoutlabel.py', wdir='D:/python_data/interface/images')
D://python_data//interface//images//preprocessed//cm_finaltesting\11_F.jpg
D://python_data//interface//images//preprocessed//cm_finaltesting\12_F.jpg
D://python_data//interface//images//preprocessed//cm_finaltesting\18_M.jpg
D://python_data//interface//images//preprocessed//cm_finaltesting\1_F.jpg
目前没有回答
相关问题 更多 >
编程相关推荐