使用GDAL加载多个文件时接收错误

2024-04-19 15:01:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经用下面的代码读取了文件的路径。在

import os
directory = os.listdir("/home/user/Downloads/SE_75_Ice")
fcount = len(directory)
i =0
while i < fcount :
    directory[i] = ('"'+'/home/user/Downloads/SE_75_Ice/'+directory[i]+'"')
    print(directory[i])
    i = i+1

我试着用下面的代码读了几个文件。在

^{pr2}$

运行上述代码时,出现以下错误:

AttributeError: 'NoneType' object has no attribute 'GetRasterBand'

我想可能是目录列表不是字符串类型,所以不能读路径

请告诉我上述问题的解决方案或如何一次读取多个文件。在


Tags: 文件代码import路径homelenosdownloads