【发布时间】:2022-12-01 03:04:24
【问题描述】:
我想按照文件中的顺序读取文件中的图片。但是当我用 python 阅读它时,它看起来很复杂。我不希望它排序。我怎样才能解决这个问题?
def read_img(path):
st = os.path.join(path, "*.JPG")
st_ = os.path.join(path, "*.jpg")
for filename in glob.glob(st):
print(st)
#print("filename-------",filename)
img_array_input.append(filename)
print("image array append : ", filename)
for filename in glob.glob(st_):
img_array_input.append(filename)
#print("filename-------",filename)
global size
size = len(img_array_input)
for i in img_array_input:
print("detection ")
detection(i)
print("detection out")
原始文件
阅读顺序
我希望它按原始文件中的顺序读取。
【问题讨论】:
-
不明白你的意思。是否要根据目录中文件的存在顺序来填充列表?如果是这样,您需要记住,订单可能与您使用的情况不同,例如,ls检查目录
-
嗨,如果问题中的代码和输出为文本,通常会更容易提供帮助。这使得调试更容易。如果那不可行,它有助于添加图像描述。
-
@NameVergessen 不赞成图像链接
-
@Cobra 完全同意你关于图像的看法。因此,只有“如果文本不可行”。