def main():
im = Image.open('terrain.png')
ter = im.load()
terr = []
for row in range(500):
trow = []
for col in range(400):
if ter[col,row][0:3] not in terrains:
print((row,col))
trow.append(5)
else:
trow.append(terrains[ter[col,row][0:3]])
terr.append(trow)
source = (200, 200)
destination = (300, 300)
文件“/Users/pranushasoma/Downloads/hw1b.py”,第175行,主要
if ter[col,row][0:3] not in terrains:
IndexError:图像索引超出范围
我该怎么办这个错误?