def CheckTrainData(): a[] = load("images") #a[i]=文件名 save a[] to a.txt b[] = load("labels") #b[i]=文件名 save b[] to b.txt #查找a[]中缺少label的 for i=1:length(a): if a[i] is not in b[]: delete a[i] #查找b[]中缺少images的 for i=i:length(b): if b[i] is not in a[]: delete b[i]
Python数组操作:https://www.w3school.com.cn/python/python_arrays.asp